/* Forum components layered on top of the existing site.css / community.css
   variables so the established look is preserved. */

.editor {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}

.editor-btn {
  min-width: 34px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.editor-btn:hover,
.editor-btn:focus-visible {
  border-color: var(--line);
  background: var(--surface);
}

.editor-area {
  min-height: 140px;
  padding: 12px 14px;
  color: var(--text);
  line-height: 1.7;
  outline: none;
  overflow-wrap: anywhere;
}

.editor-area:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}

.editor-area blockquote {
  margin: 8px 0;
  padding-left: 12px;
  border-left: 3px solid var(--primary);
  color: var(--muted);
}

.editor-area pre,
.comment-body pre,
.detail-section pre {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--soft);
  overflow-x: auto;
}

.editor-area img,
.comment-body img,
.detail-section img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

.editor-area video,
.comment-body video,
.detail-section video {
  display: block;
  max-width: 100%;
  border-radius: 10px;
}

.image-editor-canvas {
  display: block;
  width: min(100%, 680px);
  max-height: 55vh;
  object-fit: contain;
  margin: 0 auto 12px;
  border-radius: 8px;
  background: var(--soft);
}

.thread-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}

.thread-actions .button.active {
  border-color: var(--primary);
  color: var(--primary);
}

.notice {
  margin: 14px 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--soft);
  color: var(--muted);
}

.comment {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.comment.mine {
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}

.comment-body {
  margin: 6px 0;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.comment-body blockquote {
  margin: 6px 0;
  padding-left: 10px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

.poll ul {
  margin: 8px 0;
  padding-left: 18px;
}

.poll label {
  display: flex;
  gap: 8px;
  align-items: center;
}

.poll-editor {
  margin: 8px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.poll-editor legend {
  padding: 0 6px;
  font-weight: 600;
}

.poll-option-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 12px;
}

.poll-option-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.poll-option-row input {
  flex: 1;
}

.admin-row.unread {
  font-weight: 600;
}

.admin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.form-actions {
  display: flex;
  gap: 10px;
  margin: 14px 0;
}

/* Keep original responsive shell and demo geometry; only adapt forum content. */
#main:focus {
  outline: none;
}
:root[data-theme='dark'] {
  --primary: #a58aff;
}

.demo-user-link > .avatar {
  width: 45px;
  height: 45px;
  flex-shrink: 0;
}
.demo-user-link > .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.demo-detail-main,
.demo-detail-layout > * {
  min-width: 0;
}

.demo-detail-actions.thread-actions {
  gap: 24px;
  margin: 22px 0;
}

.demo-story .detail-section {
  font-size: 14px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

.demo-story .detail-section h2 {
  font-size: 18px;
  margin: 25px 0 14px;
}

.detail-video,
.demo-detail-media > video {
  display: block;
  width: 100%;
  max-height: 620px;
  object-fit: contain;
}

.demo-story audio,
.demo-story .attachment-link {
  display: block;
  margin: 14px 0;
}

.demo-story audio {
  width: min(100%, 520px);
}

.demo-cover > .gallery-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Text-only threads get a typographic cover instead of an empty placeholder.
   Tones are picked from the thread id, so a post keeps the same colour. */
.demo-cover.text {
  aspect-ratio: 4 / 5;
}

.text-cover,
.text-hero {
  --tc-ink: #241a45;
  --tc-accent: #6a4bf0;
  --tc-rule: rgba(36, 26, 69, 0.14);
  background: linear-gradient(150deg, #efe9ff 0%, #f8f5ff 58%, #f1e8ff 100%);
  color: var(--tc-ink);
}

.text-cover.tone-2,
.text-hero.tone-2 {
  --tc-ink: #33281b;
  --tc-accent: #a4632a;
  --tc-rule: rgba(51, 40, 27, 0.16);
  background: linear-gradient(150deg, #f6efe2 0%, #fdfaf4 60%, #f4ecdd 100%);
}

.text-cover.tone-3,
.text-hero.tone-3 {
  --tc-ink: #173026;
  --tc-accent: #1f7a5c;
  --tc-rule: rgba(23, 48, 38, 0.15);
  background: linear-gradient(150deg, #e4f2ea 0%, #f6fbf8 60%, #e7f3ec 100%);
}

.text-cover.tone-4,
.text-hero.tone-4 {
  --tc-ink: #3a1e28;
  --tc-accent: #b04565;
  --tc-rule: rgba(58, 30, 40, 0.15);
  background: linear-gradient(150deg, #fbe7ec 0%, #fdf7f8 60%, #f8e6ea 100%);
}

:root[data-theme='dark'] .text-cover,
:root[data-theme='dark'] .text-hero {
  --tc-ink: #f1ecff;
  --tc-accent: #bda6ff;
  --tc-rule: rgba(241, 236, 255, 0.18);
  background: linear-gradient(150deg, #251d44 0%, #1b1730 55%, #241b46 100%);
}

:root[data-theme='dark'] .text-cover.tone-2,
:root[data-theme='dark'] .text-hero.tone-2 {
  --tc-ink: #f7efe2;
  --tc-accent: #e0b184;
  --tc-rule: rgba(247, 239, 226, 0.18);
  background: linear-gradient(150deg, #2c2419 0%, #1f1a13 58%, #2a2117 100%);
}

:root[data-theme='dark'] .text-cover.tone-3,
:root[data-theme='dark'] .text-hero.tone-3 {
  --tc-ink: #e8f6ef;
  --tc-accent: #7fcfae;
  --tc-rule: rgba(232, 246, 239, 0.18);
  background: linear-gradient(150deg, #17291f 0%, #131d18 58%, #17281f 100%);
}

:root[data-theme='dark'] .text-cover.tone-4,
:root[data-theme='dark'] .text-hero.tone-4 {
  --tc-ink: #fbe9ee;
  --tc-accent: #e08ea8;
  --tc-rule: rgba(251, 233, 238, 0.18);
  background: linear-gradient(150deg, #2e1b22 0%, #1f1418 58%, #2b1a20 100%);
}

.text-cover {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  height: 100%;
  padding: 20px 20px 18px;
  overflow: hidden;
  text-align: left;
}

.text-cover::before {
  content: '';
  position: absolute;
  top: -70px;
  right: -60px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.75), transparent 68%);
  pointer-events: none;
}

:root[data-theme='dark'] .text-cover::before {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 68%);
}

.text-cover > * {
  position: relative;
  z-index: 1;
}

.text-cover-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--tc-accent);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.text-cover-eyebrow svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.text-cover-body {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  overflow: hidden;
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.66;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

.text-cover-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--tc-rule);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0.8;
}

.text-cover-foot > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-cover-arrow {
  color: var(--tc-accent);
  font-size: 12px;
}

.text-hero {
  display: block;
  position: relative;
  padding: 34px 38px 32px;
  border-bottom: 1px solid var(--tc-rule);
  overflow: hidden;
}

.text-hero::before {
  content: '';
  position: absolute;
  top: -90px;
  right: -60px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.7), transparent 68%);
  pointer-events: none;
}

:root[data-theme='dark'] .text-hero::before {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1), transparent 68%);
}

.text-hero > * {
  position: relative;
  z-index: 1;
}

.text-hero .breadcrumb {
  margin: 0 0 16px;
  color: var(--tc-ink);
  font-size: 11px;
  opacity: 0.6;
}

.text-hero .breadcrumb a {
  color: inherit;
}

.text-hero h1 {
  max-width: 17em;
  margin: 0;
  color: var(--tc-ink);
  font-size: clamp(26px, 3.2vw, 34px);
  line-height: 1.34;
  letter-spacing: -0.015em;
}

.text-hero-deck {
  max-width: 30em;
  margin: 14px 0 0;
  color: var(--tc-ink);
  font-size: 14.5px;
  line-height: 1.75;
  opacity: 0.72;
}

.text-hero + .demo-story {
  padding-top: 24px;
}

/* Reading column: cap the measure so Chinese lines stay scannable. */
.demo-story {
  padding: 30px 38px 36px;
}

.demo-story .demo-story-intro,
.demo-story .detail-section {
  max-width: 38em;
}

.demo-story .detail-section {
  font-size: 15px;
  line-height: 1.88;
}

.demo-story .detail-section p + p {
  margin-top: 1.05em;
}

/* Tags read as hashtags, not as filter chips. */
.demo-story .chips {
  gap: 14px;
  flex-wrap: wrap;
  overflow: visible;
  padding: 18px 0 2px;
}

.demo-story .chip {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
}

.demo-story .chip::before {
  content: '#';
  margin-right: 2px;
  opacity: 0.55;
}

.demo-story .chip:hover {
  text-decoration: underline;
}

/* Actions become quiet inline controls instead of four outlined buttons. */
.demo-detail-actions.thread-actions {
  gap: 4px;
  padding: 12px 0 14px;
  margin: 16px 0 0;
  border-bottom: 0;
}

.thread-actions .button {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.thread-actions .button:hover,
.thread-actions .button:focus-visible {
  background: var(--soft);
  color: var(--text);
}

.thread-actions .button.active {
  background: var(--soft);
  color: var(--primary);
}

.thread-actions .button.danger {
  color: #c0392b;
}

.thread-actions .button svg {
  width: 16px;
  height: 16px;
}

.demo-story > .comments {
  margin-top: 20px;
  padding-top: 24px;
}

/* Compact cover used by list rows: account hub and search results. */
.text-cover.mini {
  justify-content: flex-start;
  gap: 0;
  padding: 8px 8px 7px;
}

.text-cover.mini::before {
  display: none;
}

.text-cover.mini .text-cover-eyebrow {
  font-size: 0;
  gap: 0;
  letter-spacing: 0;
}

.text-cover.mini .text-cover-eyebrow svg {
  width: 11px;
  height: 11px;
}

.text-cover.mini .text-cover-body {
  margin-top: 5px;
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1.35;
  -webkit-line-clamp: 3;
}

.text-cover.mini .text-cover-foot {
  display: none;
}

.dashboard-item .thumb.text-thumb {
  display: block;
  flex-shrink: 0;
  overflow: hidden;
}

.search-result {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.search-result-main {
  flex: 1;
  min-width: 0;
}

.search-thumb {
  display: block;
  flex: 0 0 92px;
  width: 92px;
  height: 92px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--soft);
}

.search-thumb > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 600px) {
  .search-thumb {
    flex-basis: 68px;
    width: 68px;
    height: 68px;
  }
}

@media (max-width: 700px) {
  .demo-story {
    padding: 22px 20px 28px;
  }
  .text-hero {
    padding: 24px 20px 22px;
  }
  .text-hero h1 {
    font-size: 24px;
  }
  .text-cover {
    padding: 16px 16px 14px;
  }
  .text-cover-body {
    font-size: 15px;
    -webkit-line-clamp: 4;
  }
}

.demo-card-author > a > .avatar {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.demo-card-author > a > .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#thread-form,
#pm-start {
  display: grid;
  gap: 19px;
}

#pm-start > label {
  display: grid;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
}

.registration-form.form-stack {
  gap: 16px;
}

#auth-form .error-box[hidden] {
  display: none;
}

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
}
.gallery-filters .field {
  flex: 1 1 130px;
  min-width: 0;
}
.demo-card-tags a::before {
  content: '#';
  margin-right: 2px;
  opacity: 0.6;
}
/* Long tag rows wrap instead of cutting a word in half. */
.demo-waterfall .demo-card-tags {
  flex-wrap: wrap;
  row-gap: 3px;
  gap: 6px;
}
.demo-sort {
  flex-wrap: wrap;
}
.demo-story figure img {
  max-width: 100%;
  height: auto;
}
#pm-list,
.reply-form {
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  .demo-detail-actions.thread-actions {
    gap: 20px;
  }
  .demo-card-author > a > .avatar {
    width: 19px;
    height: 19px;
  }
}

@media (max-width: 650px) {
  .demo-feed-tools {
    flex-wrap: wrap;
  }
  .demo-sort {
    min-width: 0;
    max-width: 100%;
    flex-shrink: 1;
  }
  .thread-actions .button,
  .form-actions .button {
    flex: 1 1 auto;
  }
}

.oauth-buttons {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}
.oauth-divider {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 18px 0;
}
.oauth-provider {
  justify-content: center;
}
.connected-accounts {
  margin-top: 24px;
}
.connected-account {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.connected-account:last-child {
  border-bottom: 0;
}

/* Private messaging keeps the conversation stable while new messages arrive. */
.messenger {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  width: min(1440px, calc(100% - 48px));
  padding: 0;
  margin-top: 26px;
  margin-bottom: 35px;
  height: min(850px, calc(100dvh - 145px));
  min-height: 500px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  overflow: hidden;
}
.pm-sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}
.pm-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 18px 14px;
}
.pm-sidebar-head h1 {
  margin: 0;
  font-size: 23px;
}
.pm-folders {
  display: flex;
  gap: 15px;
  align-items: center;
  padding: 0 18px 14px;
  font-size: 12px;
}
.pm-folders a {
  color: var(--muted);
}
.pm-folders a[aria-current] {
  color: var(--primary);
  font-weight: 700;
}
.pm-folders a:last-child {
  margin-left: auto;
}
.pm-search {
  display: flex;
  gap: 5px;
  padding: 0 13px 14px;
}
.pm-search input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--text);
  padding: 10px;
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
}
#pm-thread-list {
  flex: 1;
  overflow-y: auto;
}
.pm-thread-row {
  display: flex;
  gap: 10px;
  color: var(--text);
  padding: 15px 14px;
  border-top: 1px solid var(--line);
  text-decoration: none;
  align-items: start;
}
.pm-thread-row:hover,
.pm-thread-row.selected {
  background: var(--soft);
  text-decoration: none;
}
.pm-thread-row > div {
  min-width: 0;
  flex: 1;
}
.pm-thread-row strong {
  font-size: 13px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pm-thread-row small {
  display: block;
  font-size: 10px;
  color: var(--muted);
}
.pm-thread-row p {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pm-unread {
  color: #fff;
  background: var(--primary);
  font-size: 10px;
  border-radius: 12px;
  padding: 2px 7px;
}
.pm-list-pages {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  gap: 10px;
}
.pm-conversation {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}
.pm-conversation-head {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.pm-conversation-head > div {
  min-width: 0;
  flex: 1;
}
.pm-conversation-head h2 {
  font-size: 17px;
  margin: 0;
  overflow-wrap: anywhere;
}
.pm-conversation-head small {
  color: var(--muted);
  font-size: 11px;
}
.pm-back {
  display: none;
}
.pm-menu {
  position: relative;
  margin-left: auto;
}
.pm-menu summary {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  list-style: none;
}
.pm-menu summary::-webkit-details-marker {
  display: none;
}
.pm-menu > div {
  position: absolute;
  right: 0;
  top: 42px;
  z-index: 5;
  display: grid;
  background: var(--surface);
  box-shadow: 0 8px 25px rgb(0 0 0 / 12%);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 190px;
  padding: 6px;
}
.pm-menu button {
  background: transparent;
  color: var(--text);
  border: 0;
  text-align: left;
  font: inherit;
  font-size: 12px;
  border-radius: 6px;
  padding: 10px;
  cursor: pointer;
}
.pm-menu button:hover {
  background: var(--soft);
}
.pm-history {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 130px;
  padding: 24px;
  background: color-mix(in srgb, var(--soft) 45%, var(--surface));
}
.pm-message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 0 0 20px;
}
.pm-message.mine {
  align-items: flex-end;
}
.pm-bubble {
  max-width: min(88%, 650px);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px 14px 14px 3px;
  padding: 12px 15px;
  min-width: 95px;
}
.pm-message.mine .pm-bubble {
  border-radius: 14px 14px 3px 14px;
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 22%, var(--line));
}
.pm-message-author {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 7px;
}
.pm-message-body {
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.pm-message-body p:last-child {
  margin-bottom: 0;
}
.pm-message-body p:first-child {
  margin-top: 0;
}
.pm-message-body pre {
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 10px;
  border-radius: 7px;
  background: var(--soft);
  font-size: 11px;
}
.pm-message-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 10px;
  color: var(--muted);
  margin: 6px 4px 0;
}
.pm-message-meta button {
  font-size: 10px;
}
.pm-file {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  padding: 9px;
  margin-top: 10px;
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
.pm-file img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 5px;
}
.pm-file > span {
  min-width: 0;
  flex: 1;
}
.pm-file strong {
  font-size: 11px;
  overflow-wrap: anywhere;
  display: block;
}
.pm-file small {
  color: var(--muted);
  font-size: 10px;
}
.pm-compose {
  padding: 15px 20px 12px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.pm-compose textarea {
  width: 100%;
  max-height: 170px;
  min-height: 85px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  font: inherit;
  font-size: 13px;
  resize: vertical;
  background: var(--surface);
  color: var(--text);
  box-sizing: border-box;
}
.pm-compose-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 9px;
}
.pm-compose-toolbar > small {
  flex: 1;
  font-size: 10px;
  color: var(--muted);
}
.pm-compose-toolbar > button {
  margin-left: auto;
}
.pm-upload-control {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  white-space: nowrap;
}
.pm-upload-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.pm-file-help {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 7px;
}
.pm-draft-file {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  margin-top: 6px;
  background: var(--soft);
  border-radius: 5px;
  font-size: 11px;
  overflow-wrap: anywhere;
}
.pm-compose-recipient {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}
.pm-compose-recipient small {
  font-size: 11px;
  color: var(--muted);
}
#pm-recipients {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.pm-welcome,
.pm-empty {
  padding: 35px 24px;
  color: var(--muted);
}
.pm-welcome {
  margin: auto;
  text-align: center;
  max-width: 460px;
}
.pm-welcome > svg {
  width: 55px;
  height: 55px;
  color: var(--primary);
  margin-bottom: 20px;
}
.pm-welcome h2 {
  color: var(--text);
}
.pm-preferences {
  padding: 28px;
  overflow-y: auto;
}
.pm-preferences h2 {
  font-size: 22px;
  margin-top: 0;
}
.pm-preferences h3 {
  margin-top: 30px;
}
.pm-preferences .muted {
  font-size: 12px;
  line-height: 1.7;
}
.pm-blocked-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 10px;
  border-top: 1px solid var(--line);
}
.pm-load {
  display: block;
  margin: 0 auto 20px;
}
.pm-new-messages {
  position: absolute;
  bottom: 220px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  box-shadow: 0 2px 10px rgb(0 0 0 / 10%);
  white-space: nowrap;
}
.pm-unavailable,
#pm-sync-status {
  padding: 12px 20px;
  font-size: 12px;
}
.pm-settings-link {
  margin-top: 22px;
}
.pm-unsubscribe {
  max-width: 580px;
  margin: 60px auto;
}
@media (max-width: 900px) {
  .messenger {
    grid-template-columns: 240px minmax(0, 1fr);
  }
  .pm-compose-toolbar > small {
    display: none;
  }
}
@media (max-width: 650px) {
  .messenger {
    display: block;
    width: calc(100% - 20px);
    margin: 12px auto 20px;
    min-height: 420px;
    height: calc(100dvh - 155px);
    border-radius: 12px;
  }
  .pm-sidebar,
  .pm-conversation {
    height: 100%;
  }
  .messenger:not(.pm-detail-open) .pm-conversation,
  .pm-detail-open .pm-sidebar {
    display: none;
  }
  .pm-back {
    display: block;
    font-size: 22px;
  }
  .pm-conversation-head {
    padding: 14px 12px;
    gap: 8px;
  }
  .pm-conversation-head h2 {
    font-size: 15px;
  }
  .pm-history {
    padding: 16px 12px;
  }
  .pm-bubble {
    max-width: 93%;
    padding: 10px 12px;
  }
  .pm-compose {
    padding: 10px;
  }
  .pm-compose textarea {
    min-height: 70px;
    max-height: 125px;
  }
  .pm-preferences {
    padding: 20px;
  }
  .pm-preferences::before {
    content: '';
  }
  .pm-preferences {
    height: 100%;
  }
  .pm-detail-open:has(.pm-preferences) .pm-sidebar {
    display: flex;
    height: auto;
  }
  .pm-detail-open:has(.pm-preferences) .pm-sidebar #pm-thread-list,
  .pm-detail-open:has(.pm-preferences) .pm-list-pages,
  .pm-detail-open:has(.pm-preferences) .pm-search {
    display: none;
  }
  .pm-detail-open:has(.pm-preferences) {
    overflow-y: auto;
  }
  .pm-detail-open:has(.pm-preferences) .pm-conversation {
    height: auto;
  }
}

.messenger [hidden],
.pm-unsubscribe [hidden] {
  display: none !important;
}
.messenger .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Auth split screen ---------- */
.auth-split {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(420px, 3fr);
  width: 100%;
  min-height: 100vh;
  background: var(--surface);
}
.auth-showcase {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 48px clamp(40px, 6vw, 96px);
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(90% 70% at 100% 100%, rgba(255, 176, 235, 0.35), transparent 60%),
    radial-gradient(90% 80% at 0% 0%, #7a68ff 0%, #5140dd 46%, #1d1743 100%);
}
.auth-showcase::after {
  content: '';
  position: absolute;
  right: -70px;
  top: -70px;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  pointer-events: none;
}
.auth-showcase-brand {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.auth-showcase-brand:hover {
  color: #fff;
  text-decoration: none;
}
.auth-showcase-brand img {
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
}
.auth-showcase-copy {
  position: relative;
  z-index: 1;
}
.auth-showcase-kicker {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}
.auth-showcase-copy h2 {
  margin: 0 0 14px;
  max-width: 16ch;
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1.1;
  letter-spacing: -0.035em;
}
.auth-showcase-lead {
  margin: 0;
  max-width: 46ch;
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  line-height: 1.7;
}
.auth-showcase-list {
  display: grid;
  gap: 16px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}
.auth-showcase-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.auth-showcase-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.14);
}
.auth-showcase-list strong {
  display: block;
  font-size: 13.5px;
}
.auth-showcase-list small {
  display: block;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12.5px;
  line-height: 1.55;
}
.auth-showcase-note {
  position: relative;
  z-index: 1;
  margin: 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
}
.auth-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 22px clamp(24px, 3vw, 44px) 36px;
  background: var(--surface);
}
.auth-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.auth-home {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.auth-home:hover {
  color: var(--primary);
}
.auth-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: flex-start;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: clamp(24px, 9vh, 88px) 0 8px;
}
.auth-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 28px;
  padding: 4px;
  border-radius: 12px;
  background: var(--soft);
}
/* The pill slides between the two tabs instead of jumping. */
.auth-tabs::before {
  content: '';
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 2px 8px -2px rgba(23, 32, 51, 0.18);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
.auth-tabs[data-active='register']::before {
  transform: translateX(calc(100% + 4px));
}
.auth-tabs a {
  position: relative;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition: color 0.2s ease;
}
.auth-tabs a:hover {
  color: var(--text);
}
.auth-tabs a[aria-current='page'] {
  color: var(--text);
}
/* Only the form area animates when switching between sign-in and registration. */
.auth-body {
  transition:
    opacity 0.16s ease,
    transform 0.16s ease,
    height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.auth-body.is-leaving {
  opacity: 0;
  transform: translateY(8px);
}
.auth-body.is-entering {
  animation: auth-body-in 0.3s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.auth-body.is-resizing {
  overflow: hidden;
  margin: -6px;
  padding: 6px;
}
@keyframes auth-body-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
/* Reduced motion keeps a quiet cross-fade but drops sliding and resizing. */
@keyframes auth-body-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .auth-tabs::before {
    transition: none;
  }
  .auth-body {
    transition: opacity 0.16s ease;
  }
  .auth-body.is-leaving {
    transform: none;
  }
  .auth-body.is-entering {
    animation: auth-body-fade 0.2s ease both;
  }
}
.auth-page #header,
.auth-page #footer,
.auth-page #mobile-nav {
  display: none;
}
.auth-page #main {
  padding: 0;
  max-width: none;
}
/* The global site header is a sticky flex bar; the card heading must not inherit it. */
.auth-card-head {
  position: static;
  z-index: auto;
  display: block;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.auth-card-head .eyebrow {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.14em;
}
.auth-card-head h1 {
  margin: 8px 0 10px;
  font-size: clamp(27px, 3vw, 34px);
  line-height: 1.15;
  letter-spacing: -0.03em;
}
.auth-card-intro {
  margin: 0 0 6px;
  max-width: 46ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
.auth-form {
  margin-top: 18px;
}
.auth-form .field {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
}
.auth-form .field > input {
  width: 100%;
  min-height: 48px;
  margin-top: 0;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  color: var(--text);
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}
.auth-form .field > input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}
.auth-submit {
  min-height: 48px;
  margin-top: 4px;
  border-radius: 12px;
  box-shadow: 0 14px 28px -18px color-mix(in srgb, var(--primary) 70%, transparent);
}
.auth-submit:hover {
  filter: brightness(1.03);
}
.auth-links {
  margin-top: 20px;
}
.auth-legal {
  margin: 16px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}
.auth-legal a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.auth-legal a:hover {
  color: var(--primary);
}
.auth-field-password {
  display: grid;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
}
.auth-field-password .registration-password {
  position: relative;
}
/* Eye icon toggle shared by every password field on the sign-in page. */
.auth-card .registration-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  min-width: 0;
  padding: 0;
  transform: translateY(-50%);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  transition:
    color 0.18s ease,
    background 0.18s ease;
}
.auth-card .registration-toggle:hover {
  background: var(--soft);
  color: var(--primary);
}
.auth-card .registration-toggle[aria-pressed='true'] {
  color: var(--primary);
}
.auth-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.auth-links a {
  font-weight: 600;
}
.auth-verify-status {
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--soft);
}
.auth-card .registration-progress {
  margin: 22px 0;
}
.auth-card .registration-progress li {
  font-size: 10.5px;
}
.auth-card .registration-form {
  margin-top: 4px;
}
.auth-card .registration-login {
  margin: 18px 0 0;
  text-align: center;
}
.auth-card .auth-switch {
  margin: 18px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.auth-card .auth-switch a {
  font-weight: 600;
}
/* Simplified registration keeps one labelled column with short hints. */
.auth-form-simple .registration-field {
  margin-bottom: 12px;
}
.auth-form-simple .registration-hint {
  display: block;
  margin-top: 6px;
}
.auth-card .oauth-divider {
  margin: 18px 0;
}
@media (max-width: 1100px) {
  .auth-split {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }
  .auth-showcase {
    gap: 22px;
    padding: 30px 28px;
  }
  .auth-showcase-copy h2 {
    max-width: none;
    font-size: 28px;
  }
  .auth-showcase-list,
  .auth-showcase-note {
    display: none;
  }
  .auth-panel {
    padding: 18px 24px 44px;
  }
  .auth-card {
    padding-top: 20px;
  }
}

@media (max-width: 560px) {
  .auth-showcase {
    padding: 22px 20px 20px;
  }
  .auth-showcase-copy h2 {
    margin-bottom: 8px;
    font-size: 23px;
  }
  .auth-showcase-lead {
    font-size: 13px;
  }
  .auth-panel {
    padding: 16px 20px 36px;
  }
}

/* Quick sign-in area: fixed-height provider buttons keep the card stable for
   one or two enabled providers. */
.auth-card .auth-quick {
  width: 100%;
  margin-top: 24px;
}
.auth-quick-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.auth-quick-label::before,
.auth-quick-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.auth-card .oauth-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.auth-card .oauth-provider {
  justify-content: center;
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease;
}
.auth-card .oauth-provider:hover {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
  background: var(--soft);
  text-decoration: none;
  transform: translateY(-1px);
}
.auth-card .oauth-provider img {
  flex: 0 0 auto;
}
.auth-card .oauth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}
.auth-card .oauth-divider::before,
.auth-card .oauth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.auth-card .auth-quick + #auth-form {
  margin-top: 16px;
}
@media (max-width: 560px) {
  .auth-card .oauth-buttons {
    grid-template-columns: 1fr;
  }
}

/* Auth inputs: one look for every field. Labels are bold, typed values are not,
   and browser autofill must not repaint the field with its own grey/blue tint. */
.auth-card input:not([type='checkbox']):not([type='radio']) {
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background-color: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.4;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}
.auth-card input::placeholder {
  color: var(--muted);
  opacity: 0.7;
  font-weight: 400;
}
.auth-card input:not([type='checkbox']):not([type='radio']):focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}
.auth-card input:-webkit-autofill,
.auth-card input:-webkit-autofill:hover,
.auth-card input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  font-size: 15px;
  font-weight: 400;
  box-shadow: 0 0 0 1000px var(--surface) inset;
  transition: background-color 9999s ease-out;
}
.auth-card .field > input,
.auth-form .field > input {
  background: var(--surface);
}
.auth-card .registration-password input {
  padding-right: 52px;
}
.auth-card .registration-hint {
  font-size: 12px;
  line-height: 1.5;
}
.auth-card .registration-field > label {
  font-size: 13px;
}
.auth-card .registration-field {
  margin: 0;
}
.auth-card .error-box {
  margin: 0;
  border: 1px solid color-mix(in srgb, #d63a5f 35%, transparent);
  font-size: 13px;
}

/* ---------- Footer preferences ---------- */
.footer-preferences {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 32px;
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.footer-preferences-title {
  margin: 0 auto 0 0;
  color: #8b96ab;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.footer-pref {
  display: flex;
  align-items: center;
  gap: 10px;
}
.footer-pref-label {
  color: #8b96ab;
  font-size: 11.5px;
}
.pref-segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}
.pref-segmented button {
  min-height: 28px;
  padding: 4px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #aab3c4;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.16s ease,
    color 0.16s ease;
}
.pref-segmented button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.pref-segmented button[aria-pressed='true'] {
  background: #fff;
  color: #1b2436;
}

/* Current registration step, derived from field completion. */
.auth-card .registration-progress li.current {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  color: var(--text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 38%, transparent);
}
.auth-card .registration-progress li.current > span {
  border-color: color-mix(in srgb, var(--primary) 50%, var(--line));
  color: var(--primary);
  background: var(--surface);
}

@media (max-width: 760px) {
  .footer-preferences {
    gap: 14px;
  }
  .footer-preferences-title {
    flex-basis: 100%;
  }
  .footer-pref {
    flex: 1 1 100%;
    justify-content: space-between;
  }
  .pref-segmented button {
    padding: 4px 14px;
  }
}

/* Search results: replies are listed under the thread that contains them. */
.search-results {
  list-style: none;
  margin: 24px 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.search-result {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  padding: 18px 20px;
}

.search-result h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  line-height: 1.35;
}

.search-result h2 a {
  color: inherit;
}

.search-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.search-meta a {
  color: var(--muted);
}

.search-snippet,
.search-matches p {
  margin: 10px 0 0;
  color: var(--text-soft, var(--muted));
  line-height: 1.6;
}

.search-matches {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.search-matches li {
  padding-left: 12px;
  border-left: 2px solid color-mix(in srgb, var(--primary) 35%, var(--line));
}

.search-matches a {
  font-size: 0.8rem;
  font-weight: 600;
}

.search-hit {
  background: color-mix(in srgb, var(--primary) 24%, transparent);
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
}

@media (max-width: 600px) {
  .search-result {
    padding: 14px 16px;
  }
}

/* Composer draft state */
.draft-status {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.draft-status[hidden] {
  display: none;
}

.draft-status.saved {
  color: var(--muted);
}

.draft-status.dirty {
  color: color-mix(in srgb, var(--primary) 80%, var(--text));
}

.draft-status.error {
  color: color-mix(in srgb, #c52e54 65%, var(--text));
}

/* First-run checklist */
.onboarding {
  margin-bottom: 20px;
}

.onboarding-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.onboarding-steps li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.onboarding-steps li > span {
  width: 1.4em;
  color: var(--muted);
}

.onboarding-steps li.done a {
  color: var(--muted);
  text-decoration: line-through;
}

.onboarding-steps li.done > span {
  color: var(--primary);
}

/* Sponsored placements remain visually secondary to community content. */
.site-ad {
  position: relative;
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--line) 80%, var(--primary));
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 92%, var(--primary));
}

.site-ad-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-ad-body > :first-child {
  margin-top: 0;
}

.site-ad-body > :last-child {
  margin-bottom: 0;
}

.site-ad a {
  color: inherit;
  text-decoration: none;
}

/* ---------- Page transition loader ---------- */
.page-transition {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: var(--bg);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s ease,
    visibility 0s linear 0.2s;
}
.page-transition.is-active {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}
/* Server-rendered on first load; the script hides it once the first view is ready. */
html:not(.js) .boot-loader {
  display: none;
}
.page-transition-card {
  display: grid;
  justify-items: center;
  gap: 14px;
}
.page-transition-card img {
  border-radius: 12px;
  animation: page-transition-pulse 1.4s ease-in-out infinite;
}
.page-transition-name {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.page-transition-bar {
  position: relative;
  width: 160px;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}
.page-transition-bar::after {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 45%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--pink, var(--primary)));
  animation: page-transition-slide 1.1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
.page-transition .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
@keyframes page-transition-slide {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(260%);
  }
}
@keyframes page-transition-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(0.94);
    opacity: 0.8;
  }
}
@media (prefers-reduced-motion: reduce) {
  .page-transition-card img {
    animation: none;
  }
  .page-transition-bar::after {
    animation-duration: 2.4s;
  }
}

/* ---------- Informational pages ---------- */
.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 28px;
}
.legal-nav a {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition:
    color 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}
.legal-nav a:hover {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
}
.legal-nav a[aria-current='page'] {
  border-color: transparent;
  background: var(--soft);
  color: var(--primary);
}
.prose .legal-section {
  margin-top: 8px;
}
.prose .legal-section h2 {
  margin-top: 34px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.prose ul {
  margin: 0 0 14px;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.8;
}
.prose li + li {
  margin-top: 8px;
}
.prose li strong {
  color: var(--text);
}
.prose p a,
.prose li a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.legal-updated {
  margin-top: 40px;
  font-size: 13px;
}

/* ---------- Account hub ---------- */
.side-menu-heading {
  margin: 14px 0 2px;
  padding: 0 16px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.side-menu-heading:first-child {
  margin-top: 0;
}
.side-menu a svg {
  flex: 0 0 auto;
}
.account-panel-head {
  margin-bottom: 20px;
}
.account-panel-head h2 {
  margin: 0 0 4px;
  font-size: 24px;
  letter-spacing: -0.02em;
}
.account-panel-head p {
  margin: 0;
}
.account-hero {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 18px;
}
.account-hero .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.account-hero-text {
  flex: 1;
  min-width: 220px;
}
.account-hero-text h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.02em;
}
.account-hero-text p {
  margin: 4px 0 0;
}
.account-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px !important;
}
.account-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.account-tag.ok {
  background: color-mix(in srgb, #1f9d6b 14%, var(--surface));
  color: #1f7a56;
}
.account-tag.warn {
  background: color-mix(in srgb, #d98a1c 16%, var(--surface));
  color: #9a6208;
}
:root[data-theme='dark'] .account-tag.ok {
  color: #5fd3a2;
}
:root[data-theme='dark'] .account-tag.warn {
  color: #f0b45a;
}
.account-identity {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  margin: 4px 0 22px;
}
.account-identity .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.account-identity-text {
  flex: 1;
  min-width: 200px;
}
.account-identity-text .eyebrow {
  margin: 0 0 2px;
}
.account-identity-text h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.02em;
}
.account-identity-text p {
  margin: 4px 0 0;
}
.account-identity .form-actions {
  margin: 0;
}
.account-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.account-stat {
  display: grid;
  gap: 2px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.account-stat strong {
  font-size: 26px;
  letter-spacing: -0.02em;
}
.account-stat span {
  color: var(--muted);
  font-size: 12.5px;
}
.account-attention {
  margin-bottom: 26px;
}
.account-attention h3 {
  margin: 0 0 12px;
  font-size: 18px;
}
.account-attention-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.account-attention-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 600;
  transition: border-color 0.18s ease;
}
.account-attention-item:hover {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
}
.account-attention-item b {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--primary);
  font-size: 12px;
  text-align: center;
}
.side-badge {
  min-width: 20px;
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
.account-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
}
.account-columns .section-head {
  margin-bottom: 14px;
}
.account-columns .section-head h3 {
  margin: 0;
  font-size: 17px;
}
.account-columns .dashboard-item {
  padding: 14px;
}
.account-columns .dashboard-item .form-actions {
  display: none;
}
.account-reply {
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.account-reply .account-reply-thread {
  display: block;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.account-reply p {
  margin: 6px 0;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.account-hub {
  max-width: 1680px;
}
.account-hub .dashboard-layout {
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 36px;
}
.account-form {
  max-width: none;
}
.account-card {
  margin-bottom: 0;
}
/* Settings fill the width: cards sit side by side instead of leaving the right empty. */
.account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}
.account-grid > .connected-accounts {
  grid-column: 1 / -1;
  margin: 0;
}
.account-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.account-switches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.account-hub form.panel,
.account-hub .pm-settings-link {
  margin-bottom: 20px;
}
.account-replies {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.account-replies .account-reply {
  margin: 0;
}
.account-card h3 {
  margin: 0 0 10px;
  font-size: 18px;
}
.account-current {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  overflow-wrap: anywhere;
}
.account-avatar {
  display: flex;
  align-items: center;
  gap: 18px;
}
.account-avatar .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.account-avatar p {
  margin: 2px 0 10px;
}
.account-switch {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.account-switch input {
  flex: 0 0 auto;
  margin-top: 3px;
}
.account-switch span {
  display: grid;
  gap: 2px;
}
.account-switch small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
}
.account-password {
  position: relative;
}
.account-password input {
  padding-right: 52px;
}
.account-eye {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.account-eye:hover,
.account-eye[aria-pressed='true'] {
  background: var(--soft);
  color: var(--primary);
}
.danger-zone {
  border-color: color-mix(in srgb, #d63a5f 40%, var(--line));
}
.danger-zone h3 {
  color: #c1294d;
}
.button.danger {
  border-color: transparent;
  background: #c1294d;
  color: #fff;
}
.button.danger:hover {
  background: #a82041;
  color: #fff;
}
.account-form .sr-only,
.account-avatar .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
@media (max-width: 1000px) {
  .account-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .account-columns,
  .account-grid,
  .account-row,
  .account-switches,
  .account-replies {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 720px) {
  .dashboard-layout,
  .account-hub .dashboard-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
  .side-menu {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
    padding-bottom: 4px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
  }
  .side-menu::-webkit-scrollbar {
    display: none;
  }
  .side-menu-heading {
    display: none;
  }
  .side-menu a {
    flex: 0 0 auto;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    font-size: 13px;
    white-space: nowrap;
    scroll-snap-align: start;
  }
  .side-menu a svg {
    width: 16px;
    height: 16px;
  }
  .side-badge {
    margin-left: 2px;
  }
}
@media (max-width: 480px) {
  .account-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.onboarding .admin-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.onboarding .admin-heading h2 {
  margin: 0;
}

/* ---------- Compact filter bar ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 14px;
  margin: 4px 0 16px;
}
.filter-field {
  display: grid;
  gap: 5px;
  min-width: 150px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.filter-field select {
  min-height: 40px;
  padding: 8px 34px 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.filter-more {
  align-self: flex-end;
}
.filter-more summary {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.filter-more summary::-webkit-details-marker {
  display: none;
}
.filter-more summary::after {
  content: '▾';
  margin-left: 8px;
  font-size: 11px;
  transition: transform 0.18s ease;
}
.filter-more[open] summary::after {
  transform: rotate(180deg);
}
.filter-more[open] {
  flex: 1 0 100%;
  order: 5;
}
.filter-more[open] summary {
  margin-bottom: 12px;
}
.filter-more-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.filter-bar .button.small {
  min-height: 40px;
}
.filter-clear {
  align-self: center;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
@media (max-width: 560px) {
  .filter-field {
    flex: 1 1 140px;
  }
}

/* ---------- Account chip + dropdown menu ---------- */
.account-menu {
  position: relative;
}
.account-menu .account-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 240px;
  padding: 4px 11px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background 0.18s ease;
}
.account-menu .account-chip:hover,
.account-menu .account-chip[aria-expanded='true'] {
  border-color: color-mix(in srgb, var(--primary) 42%, var(--line));
  background: var(--bg);
}
.account-chip-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 2px var(--surface);
}
.account-menu .account-chip .avatar {
  width: 30px;
  height: 30px;
  font-size: 13px;
}
.account-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-chip-chevron {
  display: inline-flex;
  color: var(--muted);
}
.account-chip-chevron svg {
  width: 15px;
  height: 15px;
  transform: rotate(-90deg);
  transition: transform 0.18s ease;
}
.account-menu .account-chip[aria-expanded='true'] .account-chip-chevron svg {
  transform: rotate(90deg);
}
.account-menu-external {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
}
.account-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 40;
  width: 248px;
  max-height: min(72vh, 580px);
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 18px 44px rgb(16 21 41 / 16%);
  animation: account-menu-in 0.14s ease-out;
}
.account-dropdown[hidden] {
  display: none;
}
@keyframes account-menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}
.account-menu-group + .account-menu-group {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}
.account-menu-head,
.account-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  background: transparent;
  border: 0;
  width: 100%;
  cursor: pointer;
}
.account-menu-item svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
  flex-shrink: 0;
}
.account-menu-item:hover,
.account-menu-item:focus-visible,
.account-menu-head:hover,
.account-menu-head:focus-visible {
  background: var(--soft);
}
.account-menu-head {
  gap: 11px;
  padding: 6px 10px 8px;
  border-radius: 12px;
}
.account-menu-head .avatar {
  width: 38px;
  height: 38px;
  font-size: 15px;
}
.account-menu-identity {
  display: grid;
  min-width: 0;
  line-height: 1.3;
}
.account-menu-identity strong,
.account-menu-identity small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-menu-identity strong {
  font-size: 14px;
}
.account-menu-identity small {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.account-menu-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-menu-badge {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
.account-menu-item[aria-current='page'],
.account-menu-item[aria-current='page'] svg {
  color: var(--primary);
}
.account-menu-item[data-action='sign-out'] {
  color: var(--muted);
}
@media (max-width: 560px) {
  .account-menu .account-chip {
    gap: 0;
    padding: 3px;
  }
  .account-chip-name,
  .account-chip-chevron {
    display: none;
  }
  .account-menu .account-chip .avatar {
    width: 28px;
    height: 28px;
  }
  .account-chip-dot {
    top: 0;
    right: 0;
  }
  .account-dropdown {
    width: min(248px, calc(100vw - 32px));
  }
}

/* ---------- First-paint skeleton ---------- */
.skeleton-avatar,
.skeleton-bar,
.skeleton-nav,
.skeleton-tile,
.skeleton-card {
  display: block;
  border-radius: 10px;
  background: linear-gradient(
    100deg,
    var(--soft) 30%,
    color-mix(in srgb, var(--soft) 55%, var(--surface)) 50%,
    var(--soft) 70%
  );
  background-size: 220% 100%;
  animation: skeleton-sheen 1.3s linear infinite;
}
.skeleton-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
}
.skeleton-bar {
  height: 14px;
  margin-bottom: 10px;
}
.skeleton-bar.eyebrow {
  width: 84px;
  height: 10px;
}
.skeleton-bar.title {
  width: 210px;
  height: 22px;
}
.skeleton-bar.sub {
  width: 150px;
  height: 12px;
  margin-bottom: 0;
}
.skeleton-nav {
  height: 40px;
  margin-bottom: 8px;
  border-radius: 11px;
}
.skeleton-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.skeleton-tile {
  height: 76px;
  border-radius: 14px;
}
.skeleton-card {
  height: 160px;
  margin-top: 16px;
  border-radius: 16px;
}
@keyframes skeleton-sheen {
  from {
    background-position: 120% 0;
  }
  to {
    background-position: -120% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton-avatar,
  .skeleton-bar,
  .skeleton-nav,
  .skeleton-tile,
  .skeleton-card {
    animation: none;
  }
}
@media (max-width: 1000px) {
  .skeleton-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 720px) {
  .skeleton-nav {
    flex: 0 0 auto;
    width: 120px;
    margin-bottom: 0;
  }
}
