/* Forum pages — extends theme.css design system */

/* Forum layout */
.forum-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 88px 32px 80px;
}
.forum-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 40px;
}
.forum-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* Discipline filters */
.disc-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}
.disc-filter {
  font-size: 0.82rem;
  font-weight: 500;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--muted);
  background: var(--card-bg);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.disc-filter:hover,
.disc-filter.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(27, 67, 50, 0.04);
}

/* Thread list */
.thread-list { display: flex; flex-direction: column; gap: 0; }
.thread-card {
  border-bottom: 1px solid var(--border);
  padding: 28px 0;
  display: block;
  text-decoration: none;
  color: inherit;
}
.thread-card:first-child { border-top: 1px solid var(--border); }
.thread-card:hover .thread-title { color: var(--accent); }
.thread-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.disc-badge {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(27, 67, 50, 0.08);
  padding: 3px 8px;
  border-radius: 2px;
}
.thread-date {
  font-size: 0.78rem;
  color: var(--muted);
}
.thread-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
  line-height: 1.3;
  transition: color 0.15s;
}
.thread-prompt {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.thread-byline {
  font-size: 0.78rem;
  color: var(--muted);
}
.thread-byline a { color: var(--accent); text-decoration: none; }
.thread-byline a:hover { text-decoration: underline; }

/* New thread form */
.form-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 88px 32px 80px;
}
.form-back {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 32px;
  display: inline-block;
}
.form-back:hover { color: var(--fg); }
.form-headline {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.02em;
  margin-bottom: 36px;
}
.form-group { margin-bottom: 24px; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.95rem;
  color: var(--fg);
  background: var(--card-bg);
  transition: border-color 0.15s;
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent);
}
.form-textarea { resize: vertical; min-height: 140px; }
.form-select { cursor: pointer; }
.form-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 6px;
}

/* Thread view */
.thread-view {
  max-width: 860px;
  margin: 0 auto;
  padding: 88px 32px 80px;
}
.thread-head {
  margin-bottom: 40px;
}
.thread-breadcrumb {
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 20px;
  display: inline-block;
}
.thread-breadcrumb:hover { color: var(--fg); }
.thread-head-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 16px;
}
.thread-head-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.thread-opener {
  font-size: 0.95rem;
  color: var(--fg);
  line-height: 1.85;
  padding: 24px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  margin-bottom: 12px;
}
.thread-author {
  font-size: 0.78rem;
  color: var(--muted);
}
.thread-author a { color: var(--accent); text-decoration: none; }
.thread-author a:hover { text-decoration: underline; }

/* Comment section */
.comments-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

/* Comment tree */
.comment { margin-bottom: 4px; }
.comment-body {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.comment-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.comment-author {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--fg);
}
.comment-author a { color: var(--accent); text-decoration: none; }
.comment-author a:hover { text-decoration: underline; }
.comment-date { font-size: 0.75rem; color: var(--muted); }
.comment-depth-1 { padding-left: 24px; }
.comment-depth-2 { padding-left: 48px; }
.comment-depth-3 { padding-left: 72px; }
.comment-text {
  font-size: 0.9rem;
  color: var(--fg);
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}
.reply-btn {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: 'DM Sans', system-ui, sans-serif;
}
.reply-btn:hover { color: var(--accent); }

/* Reply form */
.reply-form {
  padding-left: 24px;
  margin-top: 8px;
  margin-bottom: 16px;
}
.reply-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.88rem;
  resize: vertical;
  min-height: 80px;
  background: var(--card-bg);
}
.reply-form textarea:focus { outline: none; border-color: var(--accent); }
.reply-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.btn {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 2px;
  cursor: pointer;
  border: none;
  text-decoration: none;
  display: inline-block;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-light); }
.btn-secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-secondary:hover { color: var(--fg); border-color: var(--fg); }

/* New comment form at bottom of thread */
.new-comment-form {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.new-comment-form h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 20px;
}

/* Inline username field (both comment and thread) */
.username-group {
  display: flex;
  gap: 0;
  align-items: stretch;
}
.username-group .form-input {
  border-radius: 2px 0 0 2px;
  border-right: none;
}
.username-group .btn {
  border-radius: 0 2px 2px 0;
  white-space: nowrap;
}

/* Profile page */
.profile-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 88px 32px 80px;
}
.profile-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 36px;
  border-radius: 2px;
  margin-bottom: 40px;
}
.profile-username {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 8px;
}
.profile-bio { font-size: 0.9rem; color: var(--muted); line-height: 1.7; }
.profile-joined { font-size: 0.75rem; color: var(--muted); margin-top: 12px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 64px 32px;
  color: var(--muted);
}
.empty-state h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 10px;
}
.empty-state p { font-size: 0.88rem; line-height: 1.7; }
.empty-state .btn { margin-top: 20px; }

/* 404 page */
.not-found {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 32px;
}
.not-found h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 4rem;
  font-weight: 700;
  color: var(--border);
  margin-bottom: 16px;
}
.not-found p { color: var(--muted); margin-bottom: 24px; }

/* Suggestion list */
.suggestion-list { display: flex; flex-direction: column; gap: 0; }
.suggestion-card {
  display: flex;
  gap: 20px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.suggestion-card:first-child { border-top: 1px solid var(--border); }
.suggestion-votes {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 36px;
  padding-top: 2px;
}
.vote-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--muted);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.vote-btn:hover { border-color: var(--accent); color: var(--accent); }
.vote-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(27, 67, 50, 0.08); }
.vote-count {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
  line-height: 1;
}
.suggestion-body { flex: 1; min-width: 0; }
.suggestion-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
  display: block;
  margin-bottom: 6px;
  line-height: 1.3;
}
.suggestion-title:hover { color: var(--accent); }
.suggestion-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--muted);
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.suggestion-meta a { color: var(--accent); text-decoration: none; }
.suggestion-meta a:hover { text-decoration: underline; }
.suggestion-desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
  word-break: break-word;
}

/* Status badges */
.status-badge {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 2px;
}
.status-in_progress { background: rgba(27, 67, 50, 0.15); color: var(--accent); }
.status-completed { background: rgba(60, 130, 80, 0.12); color: #3a7a50; }
.status-declined { background: rgba(120, 120, 120, 0.1); color: var(--muted); }

/* Owner response inline */
.owner-response {
  margin-top: 10px;
  font-size: 0.8rem;
  padding: 10px 14px;
  background: rgba(27, 67, 50, 0.05);
  border-left: 2px solid var(--accent);
  border-radius: 0 2px 2px 0;
  color: var(--muted);
  line-height: 1.6;
}
.owner-label {
  font-weight: 600;
  color: var(--fg);
  display: block;
  margin-bottom: 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Suggestion detail page */
.suggestion-view-header {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 8px;
}
.suggestion-votes-lg {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-top: 4px;
}
.vote-count-lg {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1;
}
.suggestion-head-info { flex: 1; }
.suggestion-description {
  font-size: 0.95rem;
  color: var(--fg);
  line-height: 1.85;
  padding: 24px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  margin: 0 0 24px 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.owner-response-full {
  background: rgba(27, 67, 50, 0.05);
  border: 1px solid rgba(27, 67, 50, 0.15);
  border-radius: 2px;
  padding: 20px 24px;
  margin-bottom: 32px;
}
.owner-response-header {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.owner-response-full { font-size: 0.9rem; line-height: 1.75; color: var(--fg); }

/* ── Fact-checking UI ─────────────────────────────────── */

/* Search sources button in thread header */
.search-sources-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: 'DM Sans', system-ui, sans-serif;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--card-bg);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.search-sources-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Citation list under comments */
.citation-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.citation-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
}
.citation-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.citation-link:hover { text-decoration: underline; }
.citation-year {
  color: var(--muted);
  font-size: 0.7rem;
}

/* Annotation list */
.annotation-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(27, 67, 50, 0.04);
  border: 1px solid rgba(27, 67, 50, 0.1);
  border-radius: 2px;
}
.annotation-item { }
.annotation-note {
  font-size: 0.8rem;
  color: var(--fg);
  line-height: 1.6;
  margin-bottom: 4px;
}
.annotation-source {
  font-size: 0.75rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.annotation-source:hover { text-decoration: underline; }
.annotation-by { font-size: 0.7rem; color: var(--muted); }

/* Flag badges */
.flag-badge {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 2px;
}
.flag-needs_citation {
  background: rgba(200, 120, 0, 0.12);
  color: #b06000;
}
.flag-unverified {
  background: rgba(180, 40, 40, 0.1);
  color: #b02828;
}
.flag-disputed {
  background: rgba(120, 40, 180, 0.1);
  color: #7028a0;
}
.flag-count-label {
  font-size: 0.65rem;
  color: var(--muted);
  margin-left: 4px;
}

/* Comment flagged state */
.comment-flagged .comment-body {
  border-left: 2px solid rgba(200, 120, 0, 0.4);
  padding-left: 12px;
}

/* Comment action buttons */
.comment-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.flag-btn {
  font-size: 0.7rem;
  font-family: 'DM Sans', system-ui, sans-serif;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--card-bg);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.flag-btn:hover { border-color: var(--accent); color: var(--accent); }
.flag-btn-needs_citation:hover { border-color: #b06000; color: #b06000; }
.flag-btn.flag-active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(27, 67, 50, 0.06);
}

/* Citation hint in comment form */
.citation-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 20px;
  padding: 10px 14px;
  background: rgba(27, 67, 50, 0.04);
  border: 1px solid rgba(27, 67, 50, 0.1);
  border-radius: 2px;
}
.citation-hint-btn {
  background: none;
  border: none;
  font-size: 0.78rem;
  color: var(--accent);
  cursor: pointer;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 500;
  padding: 0;
  text-decoration: underline;
}

/* Academic Search Modal */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 999;
}
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.search-modal-inner {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.search-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.search-modal-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--fg);
  margin: 0;
}
.search-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  font-family: system-ui, sans-serif;
}
.search-modal-close:hover { color: var(--fg); }
.search-modal-desc {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 8px 24px 16px;
  line-height: 1.5;
  margin: 0;
}
.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 16px;
  border-bottom: 1px solid var(--border);
}
.search-icon { color: var(--muted); flex-shrink: 0; }
.search-input {
  flex: 1;
  padding: 10px 0;
  border: none;
  background: transparent;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 1rem;
  color: var(--fg);
  outline: none;
}
.search-input::placeholder { color: var(--muted); }

/* Search loading */
.search-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 24px;
  font-size: 0.82rem;
  color: var(--muted);
}
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Search results */
.search-results {
  overflow-y: auto;
  flex: 1;
  padding: 0 20px 20px;
}
.search-result-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-title {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.search-result-title a {
  color: var(--fg);
  text-decoration: none;
  line-height: 1.4;
}
.search-result-title a:hover { color: var(--accent); }
.search-result-meta {
  display: flex;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.search-result-authors { font-size: 0.75rem; color: var(--muted); }
.search-result-year { font-size: 0.75rem; color: var(--muted); }
.search-result-abstract {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 10px;
}
.search-result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.search-no-results {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 24px 0;
  text-align: center;
}
.search-error {
  font-size: 0.85rem;
  color: #b02828;
  padding: 16px 0;
  text-align: center;
}

/* Small buttons (for search results) */
.btn-sm {
  font-size: 0.72rem;
  padding: 5px 12px;
}

/* Review page */
.review-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.review-card {
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}
.review-card:first-child { border-top: 1px solid var(--border); }
.review-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.review-flags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.review-thread-link {
  font-size: 0.75rem;
  color: var(--accent);
  text-decoration: none;
}
.review-thread-link:hover { text-decoration: underline; }
.review-flagged-text {
  font-size: 0.85rem;
  color: var(--fg);
  border-left: 2px solid rgba(200, 120, 0, 0.4);
  padding-left: 12px;
  margin: 0 0 12px 0;
  line-height: 1.6;
  font-style: italic;
}
.review-post-preview {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.7;
  margin: 0 0 16px 0;
}
.review-actions { display: flex; gap: 8px; }

/* Mobile */
@media (max-width: 640px) {
  .forum-wrap, .thread-view, .form-wrap, .profile-wrap {
    padding: 80px 20px 60px;
  }
  .forum-header { flex-direction: column; gap: 12px; }
  .comment-depth-1, .comment-depth-2, .comment-depth-3 { padding-left: 0; }
  .reply-form { padding-left: 0; }
  .search-modal-inner { max-height: 90vh; }
}

/* ── Community translation suggestion UI ─────────────────────────── */

/* Affordance wrapper — positions pencil icon relative to text */
.ts-afford-wrap {
  position: relative;
  display: inline;
}
.ts-afford-text {
  /* inherits element styling */
}
.ts-pencil {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  margin-left: 4px;
  color: var(--muted);
  opacity: 0;
  vertical-align: middle;
  border-radius: 2px;
  transition: opacity 0.15s, color 0.15s;
  font-size: 0.75rem;
  line-height: 1;
}
/* Always visible on mobile for accessibility */
@media (hover: none) {
  .ts-pencil { opacity: 0.4; }
}
.ts-afford-wrap:hover .ts-pencil,
.ts-pencil:focus {
  opacity: 1;
  color: var(--accent);
}

/* Suggestion count badge */
.ts-vote-badge {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  padding: 1px 5px;
  margin-left: 2px;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  border-radius: 2px;
  text-decoration: underline dotted;
  vertical-align: middle;
  font-family: 'DM Sans', system-ui, sans-serif;
  transition: color 0.15s;
}
.ts-vote-badge:hover { color: var(--fg); }
.ts-vote-badge--hidden { display: none !important; }

/* Modal overlay */
.ts-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1100;
}

/* Modal container */
.ts-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1101;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  width: calc(100vw - 40px);
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.ts-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
  flex-shrink: 0;
}
.ts-modal-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--fg);
  margin: 0;
}
.ts-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  font-family: system-ui, sans-serif;
}
.ts-modal-close:hover { color: var(--fg); }

.ts-modal-body {
  padding: 16px 24px;
  flex: 1;
  overflow-y: auto;
}

.ts-field { margin-bottom: 16px; }
.ts-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.ts-original {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.65;
  padding: 10px 12px;
  background: rgba(0,0,0,0.03);
  border-radius: 2px;
  border: 1px solid var(--border);
  font-style: italic;
}
.ts-current {
  font-size: 0.88rem;
  color: var(--fg);
  line-height: 1.65;
  padding: 10px 12px;
  background: rgba(27, 67, 50, 0.04);
  border-radius: 2px;
  border: 1px solid rgba(27,67,50,0.15);
}
.ts-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.9rem;
  color: var(--fg);
  background: var(--card-bg);
  resize: vertical;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.ts-textarea:focus { outline: none; border-color: var(--accent); }
.ts-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.9rem;
  color: var(--fg);
  background: var(--card-bg);
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.ts-input:focus { outline: none; border-color: var(--accent); }

.ts-status {
  padding: 10px 12px;
  border-radius: 2px;
  font-size: 0.82rem;
  line-height: 1.5;
}
.ts-status--success {
  background: rgba(27, 67, 50, 0.08);
  color: var(--accent);
  border: 1px solid rgba(27,67,50,0.2);
}
.ts-status--error {
  background: rgba(180,40,40,0.07);
  color: #b02828;
  border: 1px solid rgba(180,40,40,0.2);
}

.ts-modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 0 24px 20px;
  flex-shrink: 0;
}

/* Shared button styles (ts- prefix to avoid collision with .btn) */
.ts-btn {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 2px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  line-height: 1;
}
.ts-btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.ts-btn-primary:hover:not(:disabled) { background: var(--accent-light); border-color: var(--accent-light); }
.ts-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.ts-btn-secondary {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}
.ts-btn-secondary:hover { color: var(--fg); border-color: var(--fg); }
.ts-btn-voted {
  background: rgba(27,67,50,0.1);
  color: var(--accent);
  border-color: rgba(27,67,50,0.3);
}
.ts-btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  font-size: 0.72rem;
}
.ts-btn-ghost:hover { color: #b02828; }
.ts-btn-sm {
  font-size: 0.72rem;
  padding: 4px 10px;
}

/* Vote panel */
.ts-vote-panel .ts-modal-body { padding-top: 12px; }
.ts-vote-list { padding: 0 24px; }
.ts-vote-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.ts-vote-item:last-child { border-bottom: none; }
.ts-vote-text {
  font-size: 0.9rem;
  color: var(--fg);
  line-height: 1.65;
  margin-bottom: 6px;
}
.ts-vote-note {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.55;
  font-style: italic;
  margin-bottom: 6px;
}
.ts-vote-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 10px;
}
.ts-vote-contributor { font-weight: 500; color: var(--fg); }
.ts-vote-count { }
.ts-vote-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.ts-loading, .ts-empty {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 16px 0;
  text-align: center;
}

/* Contributors page */
.contrib-stats {
  display: flex;
  gap: 32px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.contrib-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.contrib-stat-n {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.contrib-stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.contrib-note {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 32px;
  padding: 12px 16px;
  background: rgba(27,67,50,0.04);
  border-left: 2px solid var(--accent);
  border-radius: 0 2px 2px 0;
}
.contrib-note a { color: var(--accent); }
.contrib-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.contrib-table th {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.contrib-table td {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  vertical-align: middle;
}
.contrib-table tr:last-child td { border-bottom: none; }
.contrib-name { font-weight: 500; }
.contrib-anon { color: var(--muted); font-style: italic; }
.contrib-accepted {
  font-weight: 600;
  color: var(--accent);
  background: rgba(27,67,50,0.1);
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 0.78rem;
}
.contrib-pending { color: var(--muted); }
.contrib-date { color: var(--muted); font-size: 0.78rem; }