/* ===================================================================
   COMMUNITY SCREENS
   Screen-specific styles: thread detail, composer, profile,
   search, notifications, and shared UI patterns.
   =================================================================== */

/* ── Shared: empty state ─────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 24px;
  text-align: center;
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  background: var(--ds-parchment);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ds-ash);
  margin-bottom: 20px;
}

.empty-state-icon svg {
  width: 28px;
  height: 28px;
}

.empty-state-title {
  font-family: var(--ds-font-serif);
  font-size: var(--ds-text-xl);
  color: var(--ds-ink);
  margin-bottom: 8px;
}

.empty-state-body {
  font-size: var(--ds-text-sm);
  color: var(--ds-ash);
  max-width: 320px;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* ── Shared: error banner ────────────────────────────────────────────── */
.error-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: var(--ds-radius-sm);
  color: var(--ds-red);
  font-size: var(--ds-text-sm);
  line-height: 1.5;
  margin-bottom: 16px;
}

.error-banner svg {
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Thread detail ───────────────────────────────────────────────────── */
.thread-detail-wrap {
  padding: 0;
}

.thread-detail-header {
  margin-bottom: 12px;
}

.thread-detail-category {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--ds-text-xs);
  font-weight: 600;
  color: var(--ds-ash);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 12px;
  text-decoration: none;
}

.thread-detail-category:hover {
  color: var(--ds-graphite);
}

.thread-detail-title {
  font-family: var(--ds-font-serif);
  font-size: 26px;
  font-weight: 400;
  color: var(--ds-ink);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}

.thread-detail-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: var(--ds-text-xs);
  color: var(--ds-ash);
}

.thread-detail-author {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ds-graphite);
  font-size: var(--ds-text-sm);
  transition: color var(--ds-transition);
}

.thread-detail-author:hover {
  color: var(--ds-ink);
}

.thread-detail-time {
  font-size: var(--ds-text-sm);
  color: var(--ds-ash);
}

.thread-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ── Post layout (grid: vote col + body) ────────────────────────────── */
.post {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 16px;
  padding: 24px;
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-sm);
  margin-bottom: 8px;
}

.post--accepted {
  background: rgba(220, 252, 231, 0.35);
  border-color: rgba(34, 197, 94, 0.4);
}

@keyframes post-highlight-pulse {
  0%   { box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.45); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.post--highlighted {
  animation: post-highlight-pulse 1.8s ease-out forwards;
}

[data-theme="dark"] .post--accepted {
  background: rgba(34, 197, 94, 0.06);
  border-color: rgba(34, 197, 94, 0.3);
}

.vote-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.vote-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--ds-stone);
  background: var(--ds-white);
  border-radius: 8px;
  color: var(--ds-graphite);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--ds-transition);
}

.vote-btn svg { width: 14px; height: 14px; }

.vote-btn:hover {
  border-color: var(--ds-stone-dark);
  color: var(--ds-ink);
}

.vote-btn[data-vote="up"].is-voted {
  color: var(--ds-green);
  border-color: rgba(34, 197, 94, 0.4);
  background: var(--ds-mint);
}

.vote-btn[data-vote="down"].is-voted {
  color: var(--ds-red);
  border-color: rgba(239, 68, 68, 0.4);
  background: color-mix(in srgb, var(--ds-red) 10%, transparent);
}

.vote-count {
  font-family: var(--ds-font-serif);
  font-size: 20px;
  font-weight: 400;
  color: var(--ds-ink);
  padding: 2px 0;
  text-align: center;
}

.post-body { min-width: 0; }

.post-body-content p {
  font-size: var(--ds-text-md);
  color: var(--ds-graphite);
  line-height: 1.75;
  margin-bottom: 12px;
}

.post-body-content ul {
  margin: 0 0 12px 20px;
  color: var(--ds-graphite);
}

.post-body-content li { margin-bottom: 4px; }

/* ── Post footer (actions + attribution) ────────────────────────────── */
.post-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--ds-stone);
  flex-wrap: wrap;
}

.post-actions {
  display: flex;
  gap: 2px;
}

.post-action {
  background: none;
  border: none;
  font-family: var(--ds-font-body);
  font-size: 12px;
  color: var(--ds-ash);
  padding: 4px 8px;
  border-radius: var(--ds-radius-xs);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color var(--ds-transition), background var(--ds-transition);
}

.post-action:hover {
  color: var(--ds-ink);
  background: var(--ds-parchment);
}

/* ── Post attribution (inline, no card) ──────────────────────────────── */
.post-attribution {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: var(--ds-text-sm);
  color: var(--ds-ash);
  flex-shrink: 0;
}

.post-attribution .attr-label {
  font-size: 11px;
  color: var(--ds-ash);
}

.post-attribution .author-name {
  font-size: var(--ds-text-sm);
  font-weight: 500;
  color: var(--ds-ink);
  text-decoration: none;
}

.post-attribution .author-name:hover { text-decoration: underline; }

.post-attribution .attr-sep {
  color: var(--ds-graphite);
  font-size: 13px;
  line-height: 1;
}

.post-attribution .attr-time {
  font-size: 11px;
  color: var(--ds-ash);
}

.post-attribution .attr-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--ds-ink);
  text-decoration: none;
}

.post-attribution a.attr-name:hover {
  text-decoration: underline;
}

.post-attribution .attr-avatar {
  display: inline-flex;
  text-decoration: none;
  flex-shrink: 0;
}


/* ── Answers heading ─────────────────────────────────────────────────── */
.answers-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0 8px;
}

.answers-heading h2 {
  font-family: var(--ds-font-serif);
  font-size: var(--ds-text-2xl);
  font-weight: 400;
  color: var(--ds-ink);
}

/* ── Reply box ───────────────────────────────────────────────────────── */
.reply-box {
  margin-top: 32px;
  padding: 20px;
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius);
}

.reply-box-header {
  font-family: var(--ds-font-serif);
  font-size: var(--ds-text-xl);
  font-weight: 400;
  color: var(--ds-ink);
  margin-bottom: 12px;
}

.reply-box-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  gap: 12px;
  flex-wrap: wrap;
}

.reply-box-hint {
  font-size: 12px;
  color: var(--ds-ash);
}

/* ── Crumbs ──────────────────────────────────────────────────────────── */
.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--ds-text-xs);
  color: var(--ds-ash);
  margin-bottom: 12px;
}

/* ── Prose / rendered markdown body ─────────────────────────────────── */
.prose {
  font-size: var(--ds-text-base);
  line-height: 1.75;
  color: var(--ds-graphite);
}

.prose h1, .prose h2, .prose h3, .prose h4 {
  color: var(--ds-ink);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: 600;
  line-height: 1.3;
}

.prose h1 { font-size: var(--ds-text-xl); font-family: var(--ds-font-serif); font-weight: 400; }
.prose h2 { font-size: var(--ds-text-lg); }
.prose h3 { font-size: var(--ds-text-md); }

.prose p { margin-bottom: 1em; }

.prose p:last-child { margin-bottom: 0; }

.prose a {
  color: var(--ds-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose a:hover { color: var(--ds-ink); }

.prose ul, .prose ol {
  margin-bottom: 1em;
  padding-left: 1.5em;
}

.prose li { margin-bottom: 0.25em; }

.prose code {
  font-size: 0.875em;
}

.prose pre {
  background: var(--ds-void);
  color: #d4d4d4;
  border-radius: var(--ds-radius-sm);
  padding: 16px 20px;
  overflow-x: auto;
  margin-bottom: 1em;
  font-family: var(--ds-font-mono);
  font-size: 0.85em;
  line-height: 1.6;
}

.prose pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.prose blockquote {
  border-left: 3px solid var(--ds-stone-dark);
  padding: 4px 16px;
  margin: 1em 0;
  color: var(--ds-ash);
  font-style: italic;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--ds-stone);
  margin: 1.5em 0;
}

.prose strong { color: var(--ds-ink); font-weight: 600; }

/* ── Answers section ─────────────────────────────────────────────────── */
.answers-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ds-stone);
}

.answers-title {
  font-size: var(--ds-text-md);
  font-weight: 600;
  color: var(--ds-ink);
}

.answer-item {
  display: flex;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--ds-stone);
  position: relative;
}

.answer-item.is-accepted {
  background: var(--ds-mint);
  border-radius: var(--ds-radius-sm);
  padding: 20px;
  margin-bottom: 2px;
  border-bottom: none;
}

.answer-accepted-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--ds-text-xs);
  font-weight: 600;
  color: #15803d;
  margin-bottom: 8px;
}

.answer-accepted-badge svg {
  width: 14px;
  height: 14px;
}

.answer-author {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--ds-stone);
}

.answer-author-info {
  flex: 1;
  min-width: 0;
}

.answer-author-name {
  font-size: var(--ds-text-sm);
  font-weight: 500;
  color: var(--ds-graphite);
  text-decoration: none;
  display: block;
}

.answer-author-name:hover { color: var(--ds-ink); }

.answer-author-time {
  font-size: var(--ds-text-xs);
  color: var(--ds-ash);
}

.accept-answer-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  font-size: var(--ds-text-xs);
  font-weight: 500;
  color: var(--ds-ash);
  background: none;
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-sm);
  cursor: pointer;
  font-family: var(--ds-font-body);
  transition: all var(--ds-transition);
}

.accept-answer-btn:hover {
  border-color: var(--ds-green);
  color: var(--ds-green);
  background: var(--ds-mint);
}

.accept-answer-btn.is-accepted {
  background: var(--ds-green);
  border-color: var(--ds-green);
  color: var(--ds-white);
}

/* ── Answer composer ─────────────────────────────────────────────────── */
.answer-composer {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 2px solid var(--ds-stone);
}

.answer-composer-title {
  font-size: var(--ds-text-md);
  font-weight: 600;
  color: var(--ds-ink);
  margin-bottom: 16px;
}

/* ── Composer form ───────────────────────────────────────────────────── */
.composer-wrap {
  max-width: var(--ds-content-max);
  padding: 32px 0 64px;
}

.composer-header {
  margin-bottom: 28px;
}

.composer-title-text {
  font-family: var(--ds-font-serif);
  font-size: var(--ds-text-2xl);
  color: var(--ds-ink);
  font-weight: 400;
  margin-bottom: 6px;
}

.composer-subtitle {
  font-size: var(--ds-text-sm);
  color: var(--ds-ash);
}

.composer-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: var(--ds-text-sm);
  font-weight: 600;
  color: var(--ds-graphite);
}

.form-label-required::after {
  content: ' *';
  color: var(--ds-red);
}

.form-hint {
  font-size: var(--ds-text-xs);
  color: var(--ds-ash);
  margin-top: 4px;
}

.ds-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-sm);
  background: var(--ds-white);
  font-family: var(--ds-font-mono);
  font-size: 13px;
  color: var(--ds-ink);
  outline: none;
  resize: vertical;
  min-height: 200px;
  line-height: 1.6;
  transition: border-color var(--ds-transition), box-shadow var(--ds-transition);
}

.ds-textarea:focus {
  border-color: var(--ds-ink);
  box-shadow: var(--ds-focus-ring);
}

.ds-textarea::placeholder {
  color: var(--ds-ash);
  font-family: var(--ds-font-body);
}

.composer-editor-wrap {
  position: relative;
}

.char-counter {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-size: var(--ds-text-xs);
  color: var(--ds-ash);
  pointer-events: none;
}

.char-counter.is-near-limit {
  color: var(--ds-amber);
}

.char-counter.is-over-limit {
  color: var(--ds-red);
}

.composer-tabs {
  border-bottom: 1px solid var(--ds-stone);
  display: flex;
  margin-bottom: 0;
}

.composer-preview {
  padding: 16px;
  background: var(--ds-parchment);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-sm);
  min-height: 200px;
  font-size: var(--ds-text-base);
  color: var(--ds-graphite);
  line-height: 1.7;
}

.composer-tag-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.composer-tag-option {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--ds-radius-pill);
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  font-size: var(--ds-text-xs);
  font-weight: 500;
  color: var(--ds-graphite);
  cursor: pointer;
  transition: all var(--ds-transition);
  font-family: var(--ds-font-body);
}

.composer-tag-option:hover {
  border-color: var(--ds-stone-dark);
  color: var(--ds-ink);
}

.composer-tag-option.is-selected {
  background: var(--ds-ink);
  border-color: var(--ds-ink);
  color: var(--ds-white);
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 8px;
}

.composer-actions-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Sort select ─────────────────────────────────────────────────────── */
.sort-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 5px 28px 5px 10px;
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-sm);
  background: var(--ds-white);
  font-family: var(--ds-font-body);
  font-size: var(--ds-text-sm);
  color: var(--ds-graphite);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 10 6' fill='none' stroke='%23888880' stroke-width='1.5' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px 6px;
  outline: none;
  transition: border-color var(--ds-transition);
}

.sort-select:focus {
  border-color: var(--ds-ink);
  box-shadow: var(--ds-focus-ring);
}

.sort-select:hover {
  border-color: var(--ds-stone-dark);
  color: var(--ds-ink);
}

/* ── Search results ──────────────────────────────────────────────────── */
.search-wrap {
  padding: 28px 0 64px;
}

.search-header {
  margin-bottom: 24px;
}

.search-title {
  font-family: var(--ds-font-serif);
  font-size: var(--ds-text-xl);
  color: var(--ds-ink);
  margin-bottom: 6px;
}

.search-meta {
  font-size: var(--ds-text-sm);
  color: var(--ds-ash);
}

.search-input-row {
  margin-bottom: 24px;
}

.search-results {
  border-top: 1px solid var(--ds-stone);
}

mark {
  background: var(--ds-mint);
  color: var(--ds-ink);
  border-radius: 2px;
  padding: 0 1px;
}

/* ── Profile ─────────────────────────────────────────────────────────── */
.profile-wrap {
  padding: 28px 0 64px;
}

.profile-header {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 24px;
}

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

.profile-name {
  font-family: var(--ds-font-serif);
  font-size: var(--ds-text-2xl);
  color: var(--ds-ink);
  font-weight: 400;
  margin-bottom: 4px;
}

.profile-handle {
  font-size: var(--ds-text-sm);
  color: var(--ds-ash);
  margin-bottom: 10px;
}

.profile-bio {
  font-size: var(--ds-text-base);
  color: var(--ds-graphite);
  line-height: 1.6;
  max-width: 480px;
}

.profile-stats-strip {
  display: flex;
  gap: 0;
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-sm);
  overflow: hidden;
  margin-bottom: 28px;
}

.profile-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  border-right: 1px solid var(--ds-stone);
}

.profile-stat:last-child {
  border-right: none;
}

.profile-stat-num {
  font-size: var(--ds-text-xl);
  font-weight: 600;
  color: var(--ds-ink);
  line-height: 1.2;
  margin-bottom: 4px;
}

.profile-stat-label {
  font-size: 10.5px;
  color: var(--ds-ash);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
}

.profile-joined {
  font-size: var(--ds-text-xs);
  color: var(--ds-ash);
  margin-top: 8px;
}

/* ───────────────────────────────────────────────────────────────────────
   Profile V1 — tabs, replies card, threads+subscriptions bar
   ─────────────────────────────────────────────────────────────────────── */

/* Filled-pill tab counters (matches notifications "Unread" badge) */
.profile-page .ds-tab-btn { display: inline-flex; align-items: center; gap: 6px; }
.profile-page .ds-tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px;
  padding: 0 5px;
  border-radius: var(--ds-radius-pill);
  background: var(--ds-ink);
  color: var(--ds-white);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  font-feature-settings: "tnum" 1;
}
.profile-page .ds-tab-btn.is-active .ds-tab-count {
  background: var(--ds-green);
  color: var(--ds-white);
}

/* Replies card — thread-item visual language with serif vote count */
.profile-page .reply-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 16px;
  padding: 18px 16px;
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-sm);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--ds-transition), box-shadow var(--ds-transition);
  align-items: start;
}
.profile-page .reply-item:hover {
  border-color: var(--ds-stone-dark);
  box-shadow: var(--ds-shadow-sm);
}
.profile-page .reply-item:hover .reply-title { color: var(--ds-green); }
.profile-page .reply-stats {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 11px; color: var(--ds-ash);
  padding-top: 2px;
}
.profile-page .reply-stat-num {
  font-family: var(--ds-font-serif);
  font-size: 22px; font-weight: 400;
  color: var(--ds-ink);
  line-height: 1;
}
.profile-page .reply-stats.is-accepted .reply-stat-num { color: var(--ds-green); }
.profile-page .reply-accepted-tag {
  display: inline-flex; align-items: center; gap: 3px;
  color: var(--ds-green); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-top: 2px;
}
.profile-page .reply-accepted-tag::before { content: "✓"; }
.profile-page .reply-body { min-width: 0; }
.profile-page .reply-subject {
  font-size: var(--ds-text-xs);
  color: var(--ds-ash);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.profile-page .reply-title {
  font-size: 15px; font-weight: 500;
  color: var(--ds-ink);
  line-height: 1.4;
  margin-bottom: 6px;
  transition: color var(--ds-transition);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.profile-page .reply-excerpt {
  font-size: var(--ds-text-base);
  color: var(--ds-graphite);
  line-height: 1.55;
  margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.profile-page .reply-meta-line {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--ds-ash);
}
.profile-page .reply-meta-line .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ds-stone-dark); }

/* Combined bar above the threads list: type chips + search icon + Manage */
.profile-page .subs-bar {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
  min-height: 36px;
}
.profile-page .subs-typebar {
  display: flex; flex-wrap: wrap; gap: 6px;
  flex: 1; min-width: 0;
}
.profile-page .subs-typechip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  font-family: var(--ds-font-body);
  font-size: var(--ds-text-xs);
  font-weight: 500;
  color: var(--ds-graphite);
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-pill);
  cursor: pointer;
  transition: border-color var(--ds-transition), background var(--ds-transition), color var(--ds-transition);
}
.profile-page .subs-typechip:hover { border-color: var(--ds-stone-dark); }
.profile-page .subs-typechip.is-active {
  background: var(--ds-ink);
  border-color: var(--ds-ink);
  color: var(--ds-white);
}
.profile-page .subs-typechip-count {
  font-size: 10px;
  color: var(--ds-ash);
  font-weight: 600;
}
.profile-page .subs-typechip.is-active .subs-typechip-count { color: rgba(255,255,255,0.65); }

.profile-page .subs-bar-actions {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
}
.profile-page .subs-search-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-pill);
  color: var(--ds-graphite);
  cursor: pointer;
  transition: border-color var(--ds-transition), color var(--ds-transition), background var(--ds-transition);
}
.profile-page .subs-search-toggle:hover {
  border-color: var(--ds-stone-dark);
  color: var(--ds-ink);
}
.profile-page .subs-search-toggle.is-active {
  background: var(--ds-ink);
  border-color: var(--ds-ink);
  color: var(--ds-white);
}
.profile-page .subs-search-toggle svg { width: 15px; height: 15px; }

.profile-page .subs-manage-btn {
  height: 32px;
  padding: 0 14px;
  font-family: var(--ds-font-body);
  font-size: var(--ds-text-xs);
  font-weight: 500;
  color: var(--ds-graphite);
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-pill);
  cursor: pointer;
  transition: border-color var(--ds-transition), background var(--ds-transition), color var(--ds-transition);
}
.profile-page .subs-manage-btn:hover {
  border-color: var(--ds-stone-dark);
  color: var(--ds-ink);
}

/* Search overlay — slide-in over the bar (mobile-search-overlay pattern) */
.profile-page .subs-search-overlay {
  position: absolute;
  inset: 0;
  background: var(--ds-linen);
  border-radius: var(--ds-radius-pill);
  display: flex; align-items: center; gap: 8px;
  padding: 0 4px 0 12px;
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.18s ease;
  z-index: 2;
}
.profile-page .subs-search-overlay.is-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.profile-page .subs-search-overlay svg {
  width: 15px; height: 15px;
  color: var(--ds-ash);
  flex-shrink: 0;
}
.profile-page .subs-search-overlay input {
  flex: 1; min-width: 0;
  height: 32px;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--ds-font-body);
  font-size: var(--ds-text-sm);
  color: var(--ds-ink);
  -webkit-appearance: none;
}
.profile-page .subs-search-overlay input::placeholder { color: var(--ds-ash); }
.profile-page .subs-search-overlay input::-webkit-search-cancel-button { -webkit-appearance: none; }
.profile-page .subs-search-cancel {
  height: 28px;
  padding: 0 10px;
  border: none;
  background: transparent;
  color: var(--ds-graphite);
  font-family: var(--ds-font-body);
  font-size: var(--ds-text-xs);
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--ds-radius-pill);
  flex-shrink: 0;
}
.profile-page .subs-search-cancel:hover { color: var(--ds-ink); }

/* Manage-mode bulk action bar — drop-in replacement for .subs-bar */
.profile-page .subs-bulkbar {
  display: none;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  min-height: 36px;
}
.profile-page--managing .subs-bar { display: none; }
.profile-page--managing .subs-bulkbar { display: flex; }

.profile-page .subs-bulkbar-count {
  flex: 1;
  font-size: var(--ds-text-sm);
  color: var(--ds-graphite);
  padding-left: 4px;
}
.profile-page .subs-bulkbar-count strong {
  color: var(--ds-ink);
  font-weight: 600;
}
.profile-page .subs-bulkbar .ds-btn,
.profile-page .subs-bulkbar .ds-btn--danger {
  height: 32px;
  padding: 0 14px;
  font-family: var(--ds-font-body);
  font-size: var(--ds-text-xs);
  font-weight: 500;
  line-height: 1;
  border-radius: var(--ds-radius-pill);
  cursor: pointer;
  transition: border-color var(--ds-transition), background var(--ds-transition), color var(--ds-transition);
}
.profile-page .subs-bulkbar .ds-btn {
  color: var(--ds-graphite);
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
}
.profile-page .subs-bulkbar .ds-btn:hover {
  border-color: var(--ds-stone-dark);
  color: var(--ds-ink);
}
.profile-page .subs-bulkbar .ds-btn--danger {
  color: var(--ds-white);
  background: var(--ds-red);
  border: 1px solid var(--ds-red);
}
.profile-page .subs-bulkbar .ds-btn--danger:hover { filter: brightness(0.95); }
.profile-page .subs-bulkbar .ds-btn--danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}

/* Each thread row in the profile list: the wrapper IS the visual card.
   Inner <a class="thread-item"> is stripped of card chrome since <a> can't
   legally contain a sibling button — the bell sits as a wrapper-level grid
   cell while the anchor keeps the content layout. */
.profile-page .profile-thread-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 0 16px;
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-sm);
  transition: border-color var(--ds-transition), box-shadow var(--ds-transition), background var(--ds-transition);
}
.profile-page .profile-thread-row:hover {
  border-color: var(--ds-stone-dark);
  box-shadow: var(--ds-shadow-sm);
}
.profile-page .profile-thread-row:hover .thread-title { color: var(--ds-green); }
.profile-page .profile-thread-row.is-pinned {
  background: #fffbeb;
  border-color: rgba(245, 158, 11, 0.3);
}
.profile-page .profile-thread-row.is-pinned:hover {
  border-color: rgba(245, 158, 11, 0.55);
}

.profile-page--managing .profile-thread-row {
  cursor: pointer;
}
.profile-page--managing .profile-thread-row .thread-item { pointer-events: none; }
.profile-page--managing .profile-thread-row.is-selected {
  border-color: var(--ds-green);
  background: #f0fdf4; /* fallback for browsers without color-mix() */
  background: color-mix(in srgb, var(--ds-green) 4%, var(--ds-white));
}

/* Inner link: drop the standalone-card chrome, keep its internal grid */
.profile-page .profile-thread-row .thread-item {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 18px 0;
  grid-template-columns: 56px 1fr;
}
.profile-page .profile-thread-row .thread-item:hover {
  border-color: transparent;
  box-shadow: none;
  background: transparent;
}
.profile-page .profile-thread-row .thread-tags {
  margin-bottom: 8px;
}

/* Bell — sits in the wrapper's right-hand grid cell, vertically centered.
   In manage mode it doubles as the selection toggle: a green ring around the
   pill indicates the row is selected for bulk action; the bell icon inside
   continues to communicate subscribed/not-subscribed state. */
.profile-page .thread-bell {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--ds-radius-pill);
  background: transparent;
  border: 1px solid transparent;
  color: var(--ds-ash);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--ds-transition), color var(--ds-transition), border-color var(--ds-transition);
}
.profile-page .thread-bell svg { width: 16px; height: 16px; }
.profile-page .thread-bell svg .bell-body { fill: none; }
.profile-page .thread-bell:hover {
  border-color: var(--ds-stone-dark);
  color: var(--ds-graphite);
}
.profile-page .thread-bell.is-on { color: var(--ds-green); }
.profile-page .thread-bell.is-on svg .bell-body { fill: currentColor; }
.profile-page .thread-bell.is-on:hover {
  background: rgba(34,197,94,0.08);
  border-color: rgba(34,197,94,0.3);
  color: var(--ds-green);
}

/* Manage mode: bell doubles as the selection ring. The bell-body fill rule
   from .is-on still drives filled-vs-outline so the user can still see at a
   glance whether a selected row is subscribed (filled white) or not (outline). */
.profile-page--managing .profile-thread-row.is-selected .thread-bell {
  background: var(--ds-green);
  border-color: var(--ds-green);
  color: var(--ds-white);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ds-green) 25%, transparent);
}

/* Compact meta line under the title: cat-chip · time · N replies (matches v1) */
.profile-page .profile-thread-row .thread-meta-line {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: 11.5px;
  color: var(--ds-ash);
}
.profile-page .profile-thread-row .thread-meta-line .dot {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--ds-stone-dark);
}
.profile-page .profile-thread-row .cat-chip {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  font-size: var(--ds-text-xs);
  color: var(--ds-graphite);
  background: var(--ds-parchment);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-pill);
}

.profile-page .subs-empty {
  text-align: center;
  padding: 48px 24px;
  background: var(--ds-white);
  border: 1px dashed var(--ds-stone);
  border-radius: var(--ds-radius-sm);
  color: var(--ds-ash);
  margin-top: 4px;
}
.profile-page .subs-empty-title {
  font-family: var(--ds-font-serif);
  font-size: var(--ds-text-lg);
  color: var(--ds-ink);
  margin-bottom: 6px;
}
.profile-page .subs-empty-desc {
  font-size: var(--ds-text-sm);
  line-height: 1.55;
  max-width: 360px;
  margin: 0 auto;
}

/* ===================================================================
   INVITES TAB — private-mode invite minting and management.
   Single quota bar that morphs between "available" (meter + Create)
   and "full" (warning + disabled Create). Invite rows mirror the
   /users/me/invites payload: status + link/redeemer + meta + actions.
   =================================================================== */
.profile-page .invites-bar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
  min-height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--ds-radius-sm);
  flex-wrap: wrap;
  transition: background var(--ds-transition), border-color var(--ds-transition), padding var(--ds-transition);
}
.profile-page .invites-bar[data-state="full"],
.profile-page .invites-bar[data-state="blocked"] {
  padding: 10px 14px;
  background: color-mix(in srgb, var(--ds-amber) 8%, var(--ds-white));
  border-color: color-mix(in srgb, var(--ds-amber) 30%, var(--ds-stone));
}
.profile-page .invites-bar[data-state="blocked"] {
  background: color-mix(in srgb, var(--ds-red) 6%, var(--ds-white));
  border-color: color-mix(in srgb, var(--ds-red) 25%, var(--ds-stone));
}
.profile-page .invites-quota,
.profile-page .invites-warning {
  flex: 1; min-width: 0;
  font-size: var(--ds-text-sm);
  color: var(--ds-graphite);
  line-height: 1.4;
}
.profile-page .invites-quota strong,
.profile-page .invites-warning strong { color: var(--ds-ink); font-weight: 600; }
.profile-page .invites-warning {
  display: none;
  align-items: flex-start;
  gap: 10px;
}
.profile-page .invites-bar[data-state="full"] .invites-quota,
.profile-page .invites-bar[data-state="blocked"] .invites-quota { display: none; }
.profile-page .invites-bar[data-state="full"] .invites-warning,
.profile-page .invites-bar[data-state="blocked"] .invites-warning { display: flex; }
.profile-page .invites-warning-icon {
  flex-shrink: 0;
  width: 16px; height: 16px;
  color: var(--ds-amber);
  margin-top: 2px;
}
.profile-page .invites-bar[data-state="blocked"] .invites-warning-icon { color: var(--ds-red); }

.profile-page .invites-create {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 14px;
  font-family: var(--ds-font-body);
  font-size: var(--ds-text-xs);
  font-weight: 500;
  line-height: 1;
  color: var(--ds-white);
  background: var(--ds-ink);
  border: 1px solid var(--ds-ink);
  border-radius: var(--ds-radius-pill);
  cursor: pointer;
  transition: background var(--ds-transition), border-color var(--ds-transition), opacity var(--ds-transition);
  flex-shrink: 0;
}
.profile-page .invites-create:hover { background: var(--ds-void); border-color: var(--ds-void); }
.profile-page .invites-create svg { width: 14px; height: 14px; }
.profile-page .invites-create[disabled],
.profile-page .invites-create.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.profile-page .invite-list { display: flex; flex-direction: column; gap: 8px; }
.profile-page .invite-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-sm);
  transition: border-color var(--ds-transition), background var(--ds-transition);
}
.profile-page .invite-item.is-terminal .invite-link,
.profile-page .invite-item.is-terminal .invite-detail-primary { color: var(--ds-ash); }

.profile-page .invite-status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 8px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: var(--ds-radius-pill);
  border: 1px solid transparent;
  white-space: nowrap;
}
.profile-page .invite-status::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.profile-page .invite-status.is-pending {
  color: var(--ds-amber);
  background: color-mix(in srgb, var(--ds-amber) 10%, var(--ds-white));
  border-color: color-mix(in srgb, var(--ds-amber) 30%, transparent);
}
.profile-page .invite-status.is-used {
  color: var(--ds-green);
  background: var(--ds-mint);
  border-color: color-mix(in srgb, var(--ds-green) 25%, transparent);
}
.profile-page .invite-status.is-revoked,
.profile-page .invite-status.is-expired {
  color: var(--ds-ash);
  background: var(--ds-linen);
  border-color: var(--ds-stone);
}

.profile-page .invite-detail {
  min-width: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.profile-page .invite-detail-primary {
  display: flex; align-items: center; gap: 8px;
  min-width: 0;
  font-size: var(--ds-text-sm);
  color: var(--ds-ink);
}
.profile-page .invite-link {
  font-family: var(--ds-font-mono);
  font-size: 12px;
  color: var(--ds-graphite);
  background: var(--ds-linen);
  padding: 3px 8px;
  border-radius: var(--ds-radius-xs);
  border: 1px solid var(--ds-stone);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
}
.profile-page .invite-link.is-redacted {
  color: var(--ds-ash);
  letter-spacing: 0.04em;
  cursor: help;
}
.profile-page .invite-redeemer {
  display: inline-flex; align-items: center; gap: 8px;
  min-width: 0;
}
.profile-page .invite-redeemer-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--ds-stone);
  color: var(--ds-graphite);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}
.profile-page .invite-redeemer-avatar img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.profile-page .invite-redeemer-name {
  color: var(--ds-ink);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-page .invite-redeemer-handle { color: var(--ds-ash); font-size: var(--ds-text-xs); }
.profile-page .invite-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 11.5px;
  color: var(--ds-ash);
}
.profile-page .invite-meta .dot {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--ds-stone-dark);
}
.profile-page .invite-meta-warn { color: var(--ds-amber); font-weight: 500; }

.profile-page .invite-actions {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
}
.profile-page .invite-iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-pill);
  color: var(--ds-graphite);
  cursor: pointer;
  transition: border-color var(--ds-transition), color var(--ds-transition), background var(--ds-transition);
}
.profile-page .invite-iconbtn:hover { border-color: var(--ds-stone-dark); color: var(--ds-ink); }
.profile-page .invite-iconbtn:disabled { opacity: 0.5; cursor: not-allowed; }
.profile-page .invite-iconbtn svg { width: 14px; height: 14px; }
.profile-page .invite-iconbtn--danger:hover {
  color: var(--ds-red);
  border-color: color-mix(in srgb, var(--ds-red) 35%, var(--ds-stone));
  background: color-mix(in srgb, var(--ds-red) 5%, var(--ds-white));
}

.profile-page .invites-empty {
  text-align: center;
  padding: 56px 24px;
  background: var(--ds-white);
  border: 1px dashed var(--ds-stone);
  border-radius: var(--ds-radius-sm);
  color: var(--ds-ash);
  margin-top: 12px;
}
.profile-page .invites-empty-title {
  font-family: var(--ds-font-serif);
  font-size: var(--ds-text-lg);
  color: var(--ds-ink);
  margin-bottom: 6px;
}
.profile-page .invites-empty-desc {
  font-size: var(--ds-text-sm);
  line-height: 1.55;
  max-width: 380px;
  margin: 0 auto 16px;
}

#tab-panel-invites { padding-bottom: 24px; }

/* ===================================================================
   MOBILE RESPONSIVE — screen components
   =================================================================== */
@media (max-width: 767px) {
  /* ── Invite rows — collapse to two columns so meta stays readable ── */
  .profile-page .invite-item {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "status actions"
      "detail detail";
    gap: 10px 14px;
  }
  .profile-page .invite-item > .invite-status { grid-area: status; }
  .profile-page .invite-item > .invite-actions { grid-area: actions; justify-self: end; }
  .profile-page .invite-item > .invite-detail { grid-area: detail; }

  /* ── Thread detail ── */
  .thread-detail-title {
    font-size: clamp(22px, 6vw, 32px);
  }

  .thread-detail-meta {
    gap: 10px;
    font-size: 12px;
  }

  /* ── Post layout: single column on mobile ── */
  .post {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 16px;
  }

  .vote-col {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
  }

  /* Bigger vote buttons for touch */
  .vote-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--ds-radius-sm);
  }

  .vote-btn svg {
    width: 16px;
    height: 16px;
  }

  .vote-count {
    font-size: 16px;
    min-width: 28px;
    text-align: center;
  }

  /* ── Answer item ── */
  .answer-item {
    flex-direction: column;
    gap: 0;
    padding: 16px 0;
  }

  .answer-item.is-accepted {
    padding: 16px;
  }

  /* ── Post footer ── */
  .post-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .thread-post-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 12px;
    width: 100%;
  }

  .thread-post-footer .post-attribution {
    min-width: 0;
    flex-wrap: wrap;
  }

  .thread-post-actions {
    justify-self: end;
    margin-left: auto;
  }

  /* ── Reply box ── */
  .reply-box {
    padding: 16px;
  }

  .reply-box-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .reply-box-footer .ds-btn {
    justify-content: center;
  }

  /* ── Composer ── */
  .composer-wrap {
    padding: 20px 0 80px;
  }

  .composer-header {
    margin-bottom: 20px;
  }

  .composer-title-text {
    font-size: var(--ds-text-xl);
  }

  .composer-actions {
    flex-direction: column-reverse;
    gap: 8px;
    padding-top: 12px;
  }

  .composer-actions-right {
    margin-left: 0;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .composer-actions-right .ds-btn,
  .composer-actions .ds-btn {
    width: 100%;
    justify-content: center;
    padding: 10px 14px;
  }

  .ds-textarea {
    font-size: 16px; /* Prevents iOS auto-zoom */
    min-height: 160px;
  }

  .ds-input {
    height: 40px;
    font-size: 16px; /* Prevents iOS auto-zoom */
  }

  /* ── Search ── */
  .search-wrap {
    padding: 16px 0 80px;
  }

  .search-input-row .ds-search-wrap {
    width: 100% !important;
  }

  /* ── Profile ── */
  .profile-wrap {
    padding: 16px 0 80px;
  }

  .profile-header {
    gap: 16px;
    padding-bottom: 20px;
  }

  .comm-avatar-lg {
    width: 64px;
    height: 64px;
    font-size: 22px;
  }

  .profile-name {
    font-size: var(--ds-text-xl);
  }

  /* ── Notifications ── */
  .notifications-wrap {
    padding: 16px 0 80px;
  }

  .notif-row {
    padding: 12px 4px;
  }

  /* ── Empty state ── */
  .empty-state {
    padding: 48px 16px;
  }

  /* ── Crumbs ── */
  .crumbs {
    font-size: 11.5px;
  }

  /* ── Answers heading ── */
  .answers-heading h2 {
    font-size: var(--ds-text-lg);
  }

  /* ── Answer composer ── */
  .answer-composer {
    margin-top: 24px;
    padding-top: 24px;
  }

  /* ── Accept answer btn ── */
  .accept-answer-btn {
    padding: 8px 12px;
    font-size: var(--ds-text-sm);
  }
}

/* ── Notifications screen ────────────────────────────────────────────── */
.notifications-wrap {
  padding: 28px 0 64px;
}

.notifications-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ds-stone);
}

.notifications-title {
  font-family: var(--ds-font-serif);
  font-size: var(--ds-text-xl);
  color: var(--ds-ink);
  font-weight: 400;
}

.notif-list {
  border-top: 1px solid var(--ds-stone);
}

.notif-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 12px;
  border-bottom: 1px solid var(--ds-stone);
  text-decoration: none;
  color: inherit;
  transition: background var(--ds-transition);
}

.notif-row:hover {
  background: var(--ds-parchment);
}

.notif-row--unread {
  background: var(--ds-linen);
}

.notif-panel .notif-row:last-child {
  border-bottom: none;
}

.notif-type-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  background: var(--ds-parchment);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-sm);
  color: var(--ds-graphite);
}

.notif-row--unread .notif-type-icon {
  background: var(--ds-mint);
  border-color: rgba(34, 197, 94, 0.3);
  color: #15803d;
}

/* ── Notifications page (full) — bordered cards matching .thread-item ── */
.notif-page-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.notif-row--full {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 12px;
  padding: 16px;
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-sm);
  transition: border-color var(--ds-transition), box-shadow var(--ds-transition);
}

.notif-row--full:hover {
  background: var(--ds-white);
  border-color: var(--ds-stone-dark);
  box-shadow: var(--ds-shadow-sm);
}

.notif-row--full.notif-row--unread {
  background: var(--ds-white);
}

.notif-row--full .notif-type-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  margin-top: 0;
}

.notif-row--full .notif-type-icon svg {
  width: 16px;
  height: 16px;
}

.notif-row--full .notif-type-icon--accepted {
  color: var(--ds-green);
  border-color: rgba(34, 197, 94, 0.3);
  background: var(--ds-mint);
}

.notif-row--full .notif-msg {
  font-size: var(--ds-text-base);
  color: var(--ds-graphite);
  line-height: 1.45;
  margin-bottom: 4px;
}

.notif-row--full.notif-row--unread .notif-msg {
  color: var(--ds-ink);
  font-weight: 500;
}

.notif-row--full .notif-time {
  font-size: var(--ds-text-xs);
  color: var(--ds-ash);
}

.notif-row--full .notif-unread-dot {
  width: 8px;
  height: 8px;
  background: var(--ds-green);
  border-radius: 50%;
  flex-shrink: 0;
}

.notif-row--full .notif-spacer { width: 8px; }

/* ── Guides ─────────────────────────────────────────────────────────────── */

/* Layout */
.guides-layout {
  display: flex; gap: 64px; max-width: var(--ds-layout-max);
  margin: 0 auto; padding: 0 var(--ds-outer-px);
  align-items: flex-start;
}
.guides-sidebar {
  width: var(--ds-sidebar-w); min-width: var(--ds-sidebar-w); flex-shrink: 0;
  position: sticky; top: var(--ds-header-h);
  max-height: calc(100vh - var(--ds-header-h));
  overflow-y: auto; padding: 28px 0 40px; scrollbar-width: thin;
}
.guides-article-wrap {
  flex: 1; min-width: 0; max-width: var(--ds-content-max); padding: 40px 0 96px;
}

/* CMS pages layout (no sidebar, full navbar width) */
.page-cms-layout {
  max-width: var(--ds-layout-max); margin: 0 auto; padding: 0 var(--ds-outer-px);
}
.page-cms-layout .guides-article-wrap {
  max-width: 100%; padding: 20px 0 96px;
}

/* Landing */
.guides-landing { max-width: var(--ds-layout-max); margin: 0 auto; padding: 72px var(--ds-outer-px) 120px; }
.guides-hero { max-width: 600px; margin-bottom: 56px; }
.guides-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ds-ash); margin-bottom: 16px; }
.guides-title { font-family: var(--ds-font-serif); font-size: clamp(36px,5vw,56px); font-weight: 400; line-height: 1.08; letter-spacing: -.015em; color: var(--ds-ink); margin-bottom: 18px; }
.guides-title em { font-style: italic; color: var(--ds-graphite); }
.guides-desc { font-size: 16px; line-height: 1.65; color: var(--ds-graphite); max-width: 540px; }
.guides-card-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.guides-card { background: var(--ds-white); border: 1px solid var(--ds-stone); border-radius: var(--ds-radius); padding: 22px; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 8px; transition: border-color var(--ds-transition), transform var(--ds-transition); position: relative; overflow: hidden; cursor: pointer; }
.guides-card::after { content:''; position:absolute; left:0; top:0; bottom:0; width:3px; background:var(--ds-green); transform:scaleY(0); transform-origin:top; transition:transform var(--ds-transition); }
.guides-card:hover { border-color: var(--ds-stone-dark); transform: translateY(-2px); }
.guides-card:hover::after { transform: scaleY(1); }
.guides-card-icon { width:34px; height:34px; border-radius:8px; background:var(--ds-parchment); border:1px solid var(--ds-stone); display:flex; align-items:center; justify-content:center; color:var(--ds-graphite); margin-bottom:2px; }
.guides-card-icon svg { width:17px; height:17px; }
.guides-card-title { font-family: var(--ds-font-serif); font-size: 20px; font-weight: 400; color: var(--ds-ink); line-height: 1.2; }
.guides-card-desc { font-size: 13px; color: var(--ds-graphite); line-height: 1.55; }
.guides-card-meta { font-size: 11px; color: var(--ds-ash); margin-top: 8px; }

/* Index (home) layout */
#guides-home-layout { display: flex; max-width: var(--ds-layout-max); margin: 0 auto; padding: 0 var(--ds-outer-px); gap: 64px; min-height: calc(100vh - var(--ds-header-h)); }
.guides-home-main { flex: 1; min-width: 0; padding: 32px 0 80px; }
.guides-index-section-group { margin-bottom: 28px; }
.guides-index-section-group:last-child { margin-bottom: 0; }
.guides-index-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.guides-index-section-label { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 600; color: var(--ds-ash); text-transform: uppercase; letter-spacing: .09em; padding: 0; }
.guides-index-section-view-all { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 12px; border-radius: 99px; border: 1px solid var(--ds-stone); background: var(--ds-white); color: var(--ds-graphite); font-size: 12px; font-weight: 500; cursor: pointer; transition: background var(--ds-transition), border-color var(--ds-transition), color var(--ds-transition); }
.guides-index-section-view-all:hover { background: var(--ds-parchment); border-color: var(--ds-stone-dark); color: var(--ds-ink); }
.guides-index-section-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: color-mix(in srgb, var(--ds-green, #22c55e) 14%, transparent); color: color-mix(in srgb, var(--ds-green, #22c55e) 85%, var(--ds-ink)); font-size: 10px; font-weight: 600; }
.guides-index-section-card { background: var(--ds-white); border: 1px solid var(--ds-stone); border-radius: var(--ds-radius-sm); box-shadow: var(--ds-shadow-sm); overflow: hidden; }
.guides-index-section-icon { display: inline-flex; align-items: center; opacity: 0.6; }
.guides-index-section-icon svg { width: 12px; height: 12px; }
.guides-index-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 0; text-decoration: none; color: var(--ds-graphite); gap: 12px; transition: background var(--ds-transition), color var(--ds-transition); }
.guides-index-row + .guides-index-row { border-top: 1px solid var(--ds-stone); }
.guides-index-row:hover { background: var(--ds-parchment); color: var(--ds-ink); }
.guides-index-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.guides-index-row-title { font-family: var(--ds-font-serif); font-size: 20px; color: var(--ds-ink); line-height: 1.3; }
.guides-index-row-excerpt { font-size: 14px; color: var(--ds-ash); line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guides-index-row-chev { flex-shrink: 0; opacity: 0.25; display: flex; align-items: center; }
.guides-index-row-chev svg { width: 14px; height: 14px; }
.guides-home-nav-icon { display: inline-flex; align-items: center; }
.guides-home-nav-icon svg { width: 14px; height: 14px; }

/* Article breadcrumb */
.guides-preview-banner { background: #fefce8; border: 1px solid #fde047; border-radius: var(--ds-radius-sm); padding: 10px 14px; margin-bottom: 16px; font-size: 13px; color: #854d0e; }
.guides-preview-banner strong { font-weight: 600; }
.guides-article-breadcrumb { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; font-size: var(--ds-text-xs); color: var(--ds-ash); flex-wrap: wrap; }
.guides-article-breadcrumb-link { color: var(--ds-ash); text-decoration: none; transition: color var(--ds-transition); }
.guides-article-breadcrumb-link:hover { color: var(--ds-ink); }
.guides-article-breadcrumb-sep { opacity: 0.5; }

/* Article header (title + section/author below, above the card) */
.guides-article-header { margin-bottom: 20px; }
.guides-article-header h1 { font-family: var(--ds-font-serif); font-size: clamp(26px,4vw,36px); font-weight: 400; letter-spacing: -.01em; color: var(--ds-ink); line-height: 1.15; margin-bottom: 12px; }
.guides-article-header-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--ds-ash); }
.guides-article-header-meta .guides-chip { text-decoration: none; cursor: pointer; transition: border-color var(--ds-transition); }
.guides-article-header-meta .guides-chip:hover { border-color: var(--ds-stone-dark); }

/* Sharing in sticky meta row */
.guides-meta-share { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ds-ash); }
.guides-meta-share-btn { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border: 1px solid var(--ds-stone); border-radius: var(--ds-radius-pill); background: var(--ds-white); font-family: var(--ds-font-body); font-size: 11.5px; color: var(--ds-graphite); cursor: pointer; transition: border-color var(--ds-transition), color var(--ds-transition), background var(--ds-transition); }
.guides-meta-share-btn:hover { border-color: var(--ds-stone-dark); color: var(--ds-ink); background: var(--ds-parchment); }
.guides-meta-share-btn svg { width: 11px; height: 11px; }

/* Article card */
.guides-article-card { background: var(--ds-white); border: 1px solid var(--ds-stone); border-radius: var(--ds-radius); padding: 0 44px 44px; }
.guides-article-card .guides-meta-row { background: var(--ds-white); margin-left: -44px; margin-right: -44px; padding-left: 44px; padding-right: 44px; border-radius: var(--ds-radius) var(--ds-radius) 0 0; }

/* Article sidebar back link icon size */
.guides-back svg, #guides-sidebar .comm-sidebar-link-inner svg { width:12px; height:12px; }

/* Search */
.guides-search-wrap { position:relative; margin-bottom:16px; }
.guides-search-input { width:100%; height:32px; padding:0 10px 0 30px; border:1px solid var(--ds-stone); border-radius:var(--ds-radius-sm); background:var(--ds-white); font-family:var(--ds-font-body); font-size:12.5px; color:var(--ds-ink); outline:none; transition:border-color var(--ds-transition); -webkit-appearance:none; box-sizing:border-box; }
.guides-search-input:focus { border-color:var(--ds-ink); }
.guides-search-icon { position:absolute; left:9px; top:50%; transform:translateY(-50%); width:13px; height:13px; color:var(--ds-ash); pointer-events:none; }
.guides-search-icon svg { width:13px; height:13px; display:block; }
.guides-search-results { position:absolute; top:calc(100% + 4px); left:0; right:0; background:var(--ds-white); border:1px solid var(--ds-stone); border-radius:var(--ds-radius-sm); box-shadow:var(--ds-shadow-lg); z-index:200; display:none; overflow:hidden; max-height:320px; overflow-y:auto; }
.guides-search-results.is-open { display:block; }
.guides-search-result { display:block; padding:8px 12px; cursor:pointer; border-bottom:1px solid var(--ds-linen); transition:background var(--ds-transition); text-decoration:none; }
.guides-search-result:last-child { border-bottom:none; }
.guides-search-result:hover, .guides-search-result.is-focused { background:var(--ds-linen); }
.guides-search-result-title { font-size:12.5px; font-weight:500; color:var(--ds-ink); }
.guides-search-result-meta { font-size:11px; color:var(--ds-ash); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.guides-search-result-title mark, .guides-search-result-meta mark { background:var(--ds-mint); color:var(--ds-ink); border-radius:2px; font-style:normal; }

/* Accordion */
.guides-sb-section { margin-bottom: 1px; }
.guides-sb-btn { font-weight: 400; }
.guides-sb-btn.is-active::before { display: none; }
.guides-sb-pages { margin-left: 8px; max-height: 0; overflow: hidden; transition: max-height 0.28s ease; }
.guides-sb-section[data-open="true"] .guides-sb-pages { max-height: 480px; }
.guides-sb-link { text-decoration: none; font-size: 12.5px; }

/* Article content */
.guides-article { font-size:15.5px; line-height:1.75; color:var(--ds-graphite); }
.guides-article h1 { font-family:var(--ds-font-serif); font-size:clamp(26px,4vw,36px); font-weight:400; letter-spacing:-.01em; color:var(--ds-ink); margin-bottom:18px; line-height:1.15; }
.guides-article h2 { font-family:var(--ds-font-serif); font-size:22px; font-weight:400; color:var(--ds-ink); margin-top:36px; margin-bottom:12px; line-height:1.25; padding-bottom:8px; border-bottom:1px solid var(--ds-stone); }
.guides-article h3 { font-size:15px; font-weight:600; color:var(--ds-ink); margin-top:24px; margin-bottom:6px; }
.guides-article h4 { font-size:11px; font-weight:600; color:var(--ds-ash); text-transform:uppercase; letter-spacing:.08em; margin-top:18px; margin-bottom:6px; }
.guides-article h1,.guides-article h2,.guides-article h3,.guides-article h4 { position:relative; scroll-margin-top:80px; }
.guides-article p { margin-bottom:14px; }
.guides-article a { color:var(--ds-ink); text-decoration:none; }
.guides-article a:hover { color:var(--ds-graphite); }
.guides-article strong { color:var(--ds-ink); font-weight:600; }
.guides-article ul,.guides-article ol { padding-left:20px; margin-bottom:14px; }
.guides-article li { margin-bottom:5px; }
.guides-article hr { border:none; border-top:1px solid #fff; margin:32px 0; }
.guides-article code { font-family:var(--ds-font-mono); font-size:.87rem; background:var(--ds-parchment); border:1px solid var(--ds-stone); border-radius:5px; padding:1px 5px; color:var(--ds-ink); }
.guides-article pre { background:var(--ds-void); color:#d4d4d4; border-radius:var(--ds-radius-sm); padding:16px 18px; overflow-x:auto; margin-bottom:18px; font-family:var(--ds-font-mono); font-size:.87rem; line-height:1.6; }
.guides-article pre code { background:none; border:none; padding:0; color:inherit; }

/* Meta row */
.guides-meta-row { display:flex; align-items:center; gap:10px; margin-bottom:24px; padding:10px 0; border-bottom:1px solid var(--ds-stone); font-size:12px; color:var(--ds-ash); position:sticky; top:calc(var(--ds-header-h) + env(safe-area-inset-top)); background:var(--ds-linen); z-index:50; }
.guides-chip { display:inline-block; padding:2px 8px; border-radius:99px; background:var(--ds-parchment); border:1px solid var(--ds-stone); font-size:11px; color:var(--ds-graphite); }

/* TOC */
.guides-toc-wrap { position:relative; }
.guides-meta-row .guides-toc-wrap { margin-left:auto; }
.guides-toc-toggle { display:inline-flex; align-items:center; gap:6px; padding:5px 10px; background:var(--ds-white); border:1px solid var(--ds-stone); border-radius:99px; font-family:var(--ds-font-body); font-size:11.5px; font-weight:500; color:var(--ds-graphite); cursor:pointer; transition:border-color var(--ds-transition),color var(--ds-transition),background var(--ds-transition); }
.guides-toc-toggle:hover, .guides-toc-toggle[aria-expanded="true"] { color:var(--ds-ink); background:var(--ds-parchment); border-color:var(--ds-stone-dark); }
.guides-toc-toggle svg { width:12px; height:12px; }
.guides-toc-toggle .guides-toc-count { font-size:10px; color:var(--ds-ash); background:var(--ds-parchment); border-radius:99px; padding:1px 5px; }
.guides-toc-panel { position:absolute; top:calc(100% + 6px); right:0; width:260px; max-height:min(55vh,380px); overflow-y:auto; background:var(--ds-white); border:1px solid var(--ds-stone); border-radius:var(--ds-radius-sm); box-shadow:var(--ds-shadow-lg); padding:6px; opacity:0; transform:translateY(-4px) scale(.98); pointer-events:none; transform-origin:top right; transition:opacity .15s ease,transform .15s ease; z-index:60; }
.guides-toc-panel.is-open { opacity:1; transform:translateY(0) scale(1); pointer-events:auto; }
.guides-toc-link { display:block; padding:5px 8px; font-size:12.5px; color:var(--ds-graphite); text-decoration:none; cursor:pointer; border-radius:5px; transition:color var(--ds-transition),background var(--ds-transition); }
.guides-toc-link.level-3 { padding-left:18px; font-size:12px; color:var(--ds-ash); }
.guides-toc-link:hover, .guides-toc-link.is-active { color:var(--ds-ink); background:var(--ds-linen); font-weight:500; }

/* Heading anchors */
.guides-heading-anchor { display:inline-flex; align-items:center; justify-content:center; width:20px; height:20px; margin-left:6px; color:var(--ds-ash); opacity:0; vertical-align:middle; border-radius:5px; cursor:pointer; transition:opacity var(--ds-transition),color var(--ds-transition); text-decoration:none; }
.guides-heading-anchor svg { width:13px; height:13px; }
.guides-article h1:hover .guides-heading-anchor,
.guides-article h2:hover .guides-heading-anchor,
.guides-article h3:hover .guides-heading-anchor { opacity:1; }
.guides-heading-anchor:hover { color:var(--ds-ink); background:var(--ds-parchment); }

/* Code copy */
.guides-code-wrap { position:relative; margin-bottom:18px; }
.guides-code-wrap pre { margin-bottom:0; }
.guides-code-copy { position:absolute; top:7px; right:7px; width:28px; height:28px; display:inline-flex; align-items:center; justify-content:center; border:1px solid rgba(255,255,255,.12); background:rgba(255,255,255,.06); color:#d4d4d4; border-radius:6px; cursor:pointer; opacity:0; transition:opacity var(--ds-transition),background var(--ds-transition); }
.guides-code-copy svg { width:13px; height:13px; }
.guides-code-wrap:hover .guides-code-copy { opacity:1; }
.guides-code-copy:hover { background:rgba(255,255,255,.12); color:#fff; }
.guides-code-copy.is-copied { opacity:1; color:var(--ds-green); }

/* Tables */
.guides-table-wrap { margin-bottom:18px; overflow-x:auto; border:1px solid var(--ds-stone); border-radius:var(--ds-radius-sm); }
.guides-article table { width:100%; border-collapse:collapse; font-size:14px; }
.guides-article th { background:var(--ds-parchment); border-bottom:1px solid var(--ds-stone); border-right:1px solid var(--ds-stone); padding:7px 12px; text-align:left; font-weight:600; font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--ds-graphite); }
.guides-article td { background:var(--ds-linen); border-bottom:1px solid var(--ds-stone); border-right:1px solid var(--ds-stone); padding:7px 12px; color:var(--ds-graphite); vertical-align:top; }
.guides-article tr:last-child td { border-bottom:none; }
.guides-article th:last-child, .guides-article td:last-child { border-right:none; }

/* Callouts */
.guides-callout { border-radius:var(--ds-radius-sm); padding:11px 14px; margin-bottom:18px; font-size:14px; line-height:1.65; display:flex; gap:10px; align-items:flex-start; }
.guides-callout-icon { flex-shrink:0; margin-top:2px; }
.guides-callout-icon svg { width:15px; height:15px; }
.guides-callout-body p { margin-bottom:0 !important; }
.guides-callout-note    { background:var(--ds-parchment);       border:1px solid var(--ds-stone-dark); color:var(--ds-graphite); }
.guides-callout-info    { background:rgba(59,130,246,.08);      border:1px solid rgba(59,130,246,.25); }
.guides-callout-tip     { background:var(--ds-mint);            border:1px solid rgba(34,197,94,.28);  }
.guides-callout-warning { background:rgba(245,158,11,.09);      border:1px solid rgba(245,158,11,.28); }
.guides-callout-danger  { background:rgba(239,68,68,.08);       border:1px solid rgba(239,68,68,.25);  }
.guides-callout-note    .guides-callout-icon { color:var(--ds-graphite); }
.guides-callout-info    .guides-callout-icon { color:#1d4ed8; }
.guides-callout-tip     .guides-callout-icon { color:#15803d; }
.guides-callout-warning .guides-callout-icon { color:#92400e; }
.guides-callout-danger  .guides-callout-icon { color:#b91c1c; }

/* Tabs */
.guides-tabs { margin-bottom:20px; }
.guides-tabs-bar { display:flex; border-bottom:1px solid var(--ds-stone); }
.guides-tab-btn { padding:6px 16px; font-size:13px; font-family:var(--ds-font-body); font-weight:500; background:none; border:none; border-bottom:2px solid transparent; color:var(--ds-ash); cursor:pointer; margin-bottom:-1px; transition:color var(--ds-transition),border-color var(--ds-transition); }
.guides-tab-btn:hover { color:var(--ds-graphite); }
.guides-tab-btn.is-active { color:var(--ds-ink); border-bottom-color:var(--ds-green); }
.guides-tab-panel { display:none; padding:16px 0 0; }
.guides-tab-panel.is-active { display:block; }

/* Generic DS tab panels — visibility controlled by is-active class (DS.initTabs) */
.ds-tab-panel { display:none; }
.ds-tab-panel.is-active { display:block; }

/* Search results */
#search-tabs {
  margin-bottom: 32px;
}

#search-tabs .ds-tabs-bar {
  margin-bottom: 16px;
}

#search-tabs .ds-tab-panel .thread-item {
  margin-bottom: 14px;
}

#search-tabs .ds-tab-panel .thread-item:last-child {
  margin-bottom: 0;
}

/* Generic DS tab buttons — active indicator via class so DS.initTabs toggles work */
.ds-tab-btn { color:var(--ds-ash); border-bottom:2px solid transparent; margin-bottom:-2px; transition:color var(--ds-transition),border-color var(--ds-transition); }
.ds-tab-btn:hover { color:var(--ds-graphite); }
.ds-tab-btn.is-active { color:var(--ds-ink); border-bottom-color:var(--ds-green); }

/* Thread rows with subscription pill (visible only in manage mode) */
.subs-row {
  display:flex;
  align-items:stretch;
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-sm);
  transition: border-color var(--ds-transition), box-shadow var(--ds-transition);
}
/* Row is the card; suppress duplicate card styling on the inner thread-item */
.subs-row .thread-item {
  flex:1;
  min-width:0;
  background:transparent !important;
  border:none;
  border-radius:0;
  box-shadow:none;
  transition:none !important;
}
.subs-row:hover { border-color: var(--ds-stone-dark); box-shadow: var(--ds-shadow-sm); }
.subs-row:hover .thread-title { color:var(--ds-green); }

/* Pill column: zero-width and hidden outside manage mode.
   box-sizing:border-box ensures padding is included in width so
   padding-left doesn't bleed when the column is collapsed to 0. */
.subs-pill-wrap {
  box-sizing:border-box;
  width:0;
  overflow:hidden;
  flex-shrink:0;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  transition:width var(--ds-transition);
}
.subs-panel--manage .subs-pill-wrap { width:126px; padding-right:12px; }

/* Pills */
.subs-pill {
  font-size:11px;
  font-weight:500;
  white-space:nowrap;
  padding:3px 8px;
  border-radius:99px;
  border:none;
  display:inline-flex;
  align-items:center;
  gap:4px;
  user-select:none;
}
.subs-pill--yes {
  background:color-mix(in srgb,var(--ds-green) 12%,transparent);
  color:var(--ds-green);
  cursor:pointer;
  transition:background var(--ds-transition), color var(--ds-transition), outline var(--ds-transition);
  outline:1.5px solid transparent;
}
.subs-pill--yes:hover { background:color-mix(in srgb,var(--ds-green) 20%,transparent); }
.subs-pill--yes.is-selected {
  background:var(--ds-green);
  color:#fff;
  outline-color:var(--ds-green);
}
.subs-pill--no {
  background:transparent;
  color:var(--ds-ash);
  font-style:italic;
  pointer-events:none;
}

/* Highlight rows selected for unsubscribe */
.subs-row:has(.subs-pill--yes.is-selected) { background:var(--ds-linen); }

#subs-bulk-unsub[disabled] { opacity:.35; }

/* Page nav */
.guides-page-nav { display:flex; justify-content:space-between; gap:14px; padding-top:36px; margin-top:40px; border-top:1px solid var(--ds-stone); }
.guides-page-nav-btn { flex:1; max-width:260px; display:flex; flex-direction:column; gap:3px; padding:12px 16px; background:var(--ds-white); border:1px solid var(--ds-stone); border-radius:var(--ds-radius-sm); cursor:pointer; transition:border-color var(--ds-transition),transform var(--ds-transition); text-align:left; font-family:var(--ds-font-body); text-decoration:none; }
.guides-page-nav-btn:hover { border-color:var(--ds-stone-dark); transform:translateY(-1px); }
.guides-page-nav-btn.is-next { text-align:right; margin-left:auto; }
.guides-page-nav-label { font-size:10px; color:var(--ds-ash); text-transform:uppercase; letter-spacing:.1em; font-weight:600; }
.guides-page-nav-title { font-size:13.5px; color:var(--ds-ink); font-weight:500; }

/* Loading spinner */
.guides-loading { display:flex; align-items:center; gap:10px; padding:60px 0; color:var(--ds-ash); font-size:14px; }

/* Responsive */
@media (max-width: 1023px) {
  #guides-home-layout { gap: 0; padding: 0 24px; }
  #guides-home-layout .comm-sidebar { display: none; }
  .guides-home-main { padding: 20px 0 48px; max-width: 100%; }
  .guides-layout { padding: 0 24px; }
  .guides-article-wrap { padding: 28px 0 64px; max-width: 100%; }
  .page-cms-layout { padding: 0 24px; }
  .page-cms-layout .guides-article-wrap { padding: 16px 0 64px; }
  .guides-article-card { padding: 24px 28px 32px; }
  .guides-article-card .guides-meta-row { margin-left: -28px; margin-right: -28px; padding-left: 28px; padding-right: 28px; }
}
@media (max-width: 820px) {
  .guides-card-grid { grid-template-columns: 1fr 1fr; }
  .guides-landing { padding: 48px 24px 80px; }
}
@media (max-width: 767px) {
}
@media (max-width: 560px) {
  #guides-home-layout { padding: 0 16px; }
  .guides-article-card { padding: 0 20px 24px; }
  .guides-article-card .guides-meta-row { margin-left: -20px; margin-right: -20px; padding-left: 20px; padding-right: 20px; }
  .guides-meta-share { font-size: 0; gap: 0; }
  .guides-meta-share-btn { font-size: 11.5px; }
  .guides-card-grid { grid-template-columns: 1fr; }
  .guides-landing { padding: 40px 20px 64px; }
  .guides-title { font-size: 32px; }
}

/* ── Resources ────────────────────────────────────────────────────────── */

/* Resources layout — mirrors #community-layout from layout.css */
#lib-layout { display: flex; max-width: var(--ds-layout-max); margin: 0 auto; padding: 0 var(--ds-outer-px); gap: 64px; min-height: calc(100vh - var(--ds-header-h)); }

.lib-content { flex: 1; min-width: 0; padding: 32px 0 80px; }

/* Full-width hero — above #lib-layout */
.comm-hero { max-width: var(--ds-layout-max); margin: 0 auto; padding: 64px var(--ds-outer-px) 52px; }
.comm-hero .ds-eyebrow { display: inline-block; margin-bottom: 14px; }
.comm-hero h1 { margin-bottom: 16px; }
.comm-hero .ds-lead { max-width: 600px; }

/* Subtoolbar */
.lib-subtoolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.lib-result-count { font-size: 12.5px; color: var(--ds-ash); }
.lib-result-count strong { color: var(--ds-ink); font-weight: 500; }

/* Field hints inside forms */
.lib-field-hint { font-size: 11.5px; color: var(--ds-ash); margin-top: 4px; }

/* Resource list */
.lib-grid { display: flex; flex-direction: column; gap: 8px; }

/* ── Resource row card ─── */
.lib-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  padding: 18px;
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-sm);
  align-items: stretch;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--ds-transition), box-shadow var(--ds-transition);
}
.lib-row:hover { border-color: var(--ds-stone-dark); box-shadow: var(--ds-shadow-sm); }
.lib-row:hover .lib-row-title { color: var(--ds-green); }
.lib-row:focus-visible { outline: none; border-color: var(--ds-ink); box-shadow: var(--ds-focus-ring); }

.lib-row-body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.lib-row-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lib-row-title {
  font-size: 15.5px;
  font-weight: 500;
  color: var(--ds-ink);
  line-height: 1.4;
  transition: color var(--ds-transition);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lib-row-desc {
  font-size: 13px;
  color: var(--ds-graphite);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lib-row-tags { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-top: 2px; }

.lib-row-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-shrink: 0;
  min-width: 120px;
}
.lib-row-aside-top { display: inline-flex; align-items: center; gap: 4px; }
.lib-row-saves {
  font-family: var(--ds-font-mono);
  font-size: 12px;
  color: var(--ds-ash);
  font-feature-settings: 'tnum' 1;
  min-width: 28px;
  text-align: right;
}
.lib-row-author {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ds-graphite);
  min-width: 0;
  max-width: 180px;
}
.lib-row-author-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-row-author[data-author-handle] { cursor: pointer; transition: color var(--ds-transition); }
.lib-row-author[data-author-handle]:hover { color: var(--ds-ink); }
.lib-row-author[data-author-handle]:hover .lib-row-author-name { text-decoration: underline; text-underline-offset: 3px; }
.lib-row-author[data-author-handle]:focus-visible { outline: none; color: var(--ds-ink); }
.lib-row-author[data-author-handle]:focus-visible .lib-row-author-name { text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 720px) {
  .lib-row { grid-template-columns: 1fr; gap: 14px; padding: 16px 14px; }
  .lib-row-aside { flex-direction: row; justify-content: space-between; width: 100%; min-width: 0; align-items: center; }
}

/* Empty state */
.lib-empty { text-align: center; padding: 64px 24px; border: 1px dashed var(--ds-stone-dark); border-radius: var(--ds-radius); background: var(--ds-white); }
.lib-empty h4 { font-family: var(--ds-font-serif); font-size: var(--ds-text-xl); font-weight: 400; margin-bottom: 6px; }

/* Tag cloud inside sidebar */
.lib-tag-cloud { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 10px; }

/* Contributor rows in sidebar */
.lib-contributor-list { display: flex; flex-direction: column; gap: 1px; }

/* ── Favorite button ─── */
@keyframes fav-pop { 0% { transform: scale(1); } 35% { transform: scale(1.4); } 70% { transform: scale(.9); } 100% { transform: scale(1); } }
.lib-fav-btn { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border: 1px solid transparent; background: none; border-radius: var(--ds-radius-xs); color: var(--ds-ash); cursor: pointer; transition: color var(--ds-transition), background var(--ds-transition), border-color var(--ds-transition); flex-shrink: 0; padding: 0; }
.lib-fav-btn:hover { color: var(--ds-ink); background: var(--ds-parchment); }
.lib-fav-btn.is-saved { color: #e07b39; border-color: rgba(224,123,57,.3); background: rgba(224,123,57,.06); }
.lib-fav-btn.is-saved svg { fill: #e07b39; }
.lib-fav-btn.is-popping { animation: fav-pop .35s cubic-bezier(.22,1,.36,1); }
.lib-fav-btn svg { width: 14px; height: 14px; transition: fill var(--ds-transition); }
/* Detail page variant */
.lib-fav-btn--lg { width: auto; height: auto; padding: 7px 14px; gap: 6px; font-size: 13px; font-weight: 500; border: 1px solid var(--ds-stone); border-radius: var(--ds-radius-sm); background: var(--ds-white); color: var(--ds-graphite); }
.lib-fav-btn--lg:hover { border-color: var(--ds-stone-dark); color: var(--ds-ink); }
.lib-fav-btn--lg.is-saved { color: #e07b39; border-color: rgba(224,123,57,.3); background: rgba(224,123,57,.06); }
.lib-fav-btn--lg.is-saved svg { fill: #e07b39; }
.lib-fav-btn--lg svg { width: 14px; height: 14px; }

/* ── Detail layout ─── */
#lib-detail-layout { display: flex; max-width: var(--ds-layout-max); margin: 0 auto; padding: 0 var(--ds-outer-px); gap: 64px; min-height: calc(100vh - var(--ds-header-h)); }
.lib-detail-content { flex: 1; min-width: 0; max-width: var(--ds-content-max); padding: 28px 0 64px; }
.lib-detail-card { background: var(--ds-white); border: 1px solid var(--ds-stone); border-radius: var(--ds-radius-sm); padding: 24px; margin-bottom: 8px; }

.lib-detail-breadcrumb { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; font-size: var(--ds-text-xs); color: var(--ds-ash); }
.lib-detail-breadcrumb a, .lib-detail-breadcrumb button { color: var(--ds-ash); background: none; border: none; font-family: var(--ds-font-body); font-size: var(--ds-text-xs); cursor: pointer; padding: 0; text-decoration: none; transition: color var(--ds-transition); }
.lib-detail-breadcrumb a:hover, .lib-detail-breadcrumb button:hover { color: var(--ds-ink); }
.lib-detail-breadcrumb-sep { opacity: .6; }

.lib-detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.lib-detail-header-body { flex: 1; min-width: 0; }
.lib-detail-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex-shrink: 0; padding-top: 4px; }
.lib-detail-title { font-family: var(--ds-font-serif); font-size: 26px; font-weight: 400; line-height: 1.2; letter-spacing: -.01em; color: var(--ds-ink); margin-bottom: 12px; }
.lib-detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: var(--ds-text-xs); color: var(--ds-ash); }
.lib-detail-meta-author { display: flex; align-items: center; gap: 6px; font-size: var(--ds-text-sm); color: var(--ds-graphite); }

.lib-detail-section-label { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ds-ash); margin-bottom: 12px; }
.lib-detail-desc { font-size: var(--ds-text-md); line-height: 1.75; color: var(--ds-graphite); }

.lib-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 32px; }
.lib-detail-actions .ds-btn-primary { flex: 1; justify-content: center; min-width: 160px; }

/* ── Comments ─── */
.lib-comment { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--ds-stone); }
.lib-comment:last-of-type { border-bottom: none; }
.lib-comment-body { flex: 1; min-width: 0; }
.lib-comment-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; flex-wrap: wrap; }
.lib-comment-author { font-size: 13px; font-weight: 600; color: var(--ds-ink); }
.lib-comment-author--official { color: #15803d; }
.lib-comment-date { font-size: 11.5px; color: var(--ds-ash); }
.lib-comment-text { font-size: var(--ds-text-base); color: var(--ds-graphite); line-height: 1.65; }
.lib-comment-like { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--ds-ash); background: none; border: 1px solid transparent; cursor: pointer; padding: 3px 5px; border-radius: var(--ds-radius-xs); margin-top: 6px; font-family: var(--ds-font-body); transition: color var(--ds-transition), background var(--ds-transition), border-color var(--ds-transition); }
.lib-comment-like:hover { color: var(--ds-ink); background: var(--ds-parchment); }
.lib-comment-like.is-liked { color: #e07b39; border-color: rgba(224,123,57,.3); background: rgba(224,123,57,.06); }
.lib-comment-like.is-liked svg { fill: #e07b39; }
.lib-comment-like svg { width: 12px; height: 12px; transition: fill var(--ds-transition); }
.lib-comment-form { display: flex; gap: 12px; padding-top: 16px; align-items: flex-start; }
.lib-comment-form-wrap { flex: 1; min-width: 0; background: var(--ds-white); border: 1px solid var(--ds-stone); border-radius: var(--ds-radius-sm); overflow: hidden; transition: border-color var(--ds-transition), box-shadow var(--ds-transition); }
.lib-comment-form-wrap:focus-within { border-color: var(--ds-ink); box-shadow: var(--ds-focus-ring); }
.lib-comment-textarea { width: 100%; padding: 10px 14px; border: none; resize: none; font-family: var(--ds-font-body); font-size: 13.5px; color: var(--ds-ink); background: transparent; outline: none; min-height: 40px; max-height: 200px; line-height: 1.55; display: block; }
.lib-comment-textarea::placeholder { color: var(--ds-ash); }
.lib-comment-form-foot { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px 8px; border-top: 1px solid var(--ds-stone); }
.lib-comment-form-hint { font-size: 11px; color: var(--ds-ash); }
.lib-comment-empty { padding: 20px; text-align: center; border: 1px dashed var(--ds-stone); border-radius: var(--ds-radius-sm); color: var(--ds-ash); font-size: 13px; }

/* ── Responsive ─── */
@media (max-width: 1023px) {
  #lib-layout, #lib-detail-layout { gap: 0; padding: 0 24px; }
  #lib-layout .comm-sidebar, #lib-detail-layout .comm-sidebar { display: none; }
  .lib-content, .lib-detail-content { padding: 20px 0 48px; max-width: 100%; }
  .comm-hero { padding: 48px 24px 40px; }
}
@media (max-width: 560px) {
  #lib-layout, #lib-detail-layout { padding: 0 16px; }
  .comm-hero { padding: 40px 16px 32px; }
  .lib-detail-title { font-size: clamp(24px, 6vw, 32px); }
  .lib-detail-actions .ds-btn-primary { min-width: auto; }
}
@media (max-width: 767px) {
  .comm-hero { display: none; }
  .lib-subtoolbar { display: none; }
  .lib-content { padding-top: 20px; }
}

/* ── Composer modal: compact on mobile ─────────────────────────────── */
@media (max-width: 767px) {
  .ds-modal .composer-form {
    gap: 12px;
  }
  /* Prevent iOS from zooming on input focus (requires font-size >= 16px) */
  .ds-modal .ds-input,
  .ds-modal textarea.ds-input {
    font-size: 16px !important;
  }
  /* Sticky submit bar so the button is always reachable */
  .ds-modal .composer-actions-wrap {
    position: sticky;
    bottom: 0;
    margin: 0 -20px -16px;
    padding: 10px 20px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    background: var(--ds-white);
    border-top: 1px solid var(--ds-stone);
  }
}

/* ── Composer draft banner ───────────────────────────────────────── */
.composer-draft-banner {
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--ds-stone-dark);
  border-radius: var(--ds-radius-sm);
  background: var(--ds-parchment);
  color: var(--ds-ink);
}
.composer-draft-banner__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  color: var(--ds-graphite);
}
.composer-draft-banner__body {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}
.composer-draft-banner__title {
  font-weight: 600;
  font-size: var(--ds-text-sm);
  color: var(--ds-ink);
}
.composer-draft-banner__hint {
  font-size: var(--ds-text-xs);
  color: var(--ds-ash);
  margin-top: 2px;
}
.composer-draft-banner__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-self: center;
}
@media (max-width: 480px) {
  .composer-draft-banner {
    flex-wrap: wrap;
  }
  .composer-draft-banner__actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ── Inline image upload (GitHub-style drag onto textarea) ───────── */
.image-upload-wrap { position: relative; }
.image-upload-overlay {
  position: absolute; inset: 0;
  background: rgba(29, 78, 216, 0.08);
  border: 2px dashed #1d4ed8;
  border-radius: var(--ds-radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--ds-text-sm); font-weight: 500;
  color: #1d4ed8;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 5;
}
.image-upload-wrap[data-drag="true"] .image-upload-overlay { opacity: 1; }
.image-upload-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  margin-top: 4px;
  border: 1px dashed var(--ds-stone);
  border-radius: 4px;
  background: var(--ds-parchment);
  color: var(--ds-ash);
  font-size: var(--ds-text-xs);
  line-height: 1.3;
}
.image-upload-footer__msg { display: flex; align-items: center; gap: 6px; }
.image-upload-footer__btn {
  font-size: var(--ds-text-xs);
  padding: 3px 8px;
  border: 1px solid var(--ds-stone-dark);
  background: var(--ds-white);
  color: var(--ds-graphite);
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}
.image-upload-footer__btn:hover { background: var(--ds-parchment); border-color: var(--ds-ink); color: var(--ds-ink); }
.image-upload-footer[data-state="uploading"] { color: #1d4ed8; border-color: #1d4ed8; }
.image-upload-footer[data-state="error"] { color: var(--ds-red); border-color: var(--ds-red); background: rgba(239, 68, 68, 0.04); }
.image-upload-footer[data-state="success"] { color: #065f46; border-color: #6ee7b7; background: rgba(16, 185, 129, 0.06); }

/* Responsive images in rendered markdown content */
.thread-body img,
.answer-body img,
.guides-article img,
.docs-article img,
.page-article img,
.markdown-body img,
.resource-description img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--ds-radius-sm);
  margin: 8px 0;
}

/* Member-side image picker (My library) */
.image-picker-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.image-picker-dialog {
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow-lg);
  width: 100%; max-width: 720px;
  display: grid; grid-template-rows: auto 1fr auto;
  max-height: 80vh; overflow: hidden;
}
.image-picker-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--ds-stone);
}
.image-picker-head h3 { font-family: var(--ds-font-serif); font-size: var(--ds-text-lg); color: var(--ds-ink); }
.image-picker-close {
  width: 28px; height: 28px; border: none; background: none; cursor: pointer;
  color: var(--ds-ash); font-size: 16px; border-radius: 6px;
}
.image-picker-close:hover { background: var(--ds-parchment); color: var(--ds-ink); }
.image-picker-body { padding: 16px 18px; overflow: auto; min-height: 200px; }
.image-picker-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 18px; border-top: 1px solid var(--ds-stone);
  background: var(--ds-parchment);
}
.image-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.image-picker-tile {
  position: relative; aspect-ratio: 1/1;
  background: var(--ds-parchment);
  border: 2px solid transparent;
  border-radius: 6px; overflow: hidden;
  cursor: pointer;
}
.image-picker-tile img { width: 100%; height: 100%; object-fit: cover; }
.image-picker-tile[data-selected] { border-color: var(--ds-ink); }
.image-picker-meta {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 4px 6px;
  font-size: 10px; font-family: var(--ds-font-mono);
  color: var(--ds-white);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
}
.image-picker-empty {
  text-align: center; color: var(--ds-ash);
  padding: 60px 20px; font-size: var(--ds-text-sm);
}
