/* ═══════════════════════════════════════════════════════════════════════════
   PHYSICAPRESS — COMMUNITY FEATURES CSS (v4.6.2)
   Modals, reaction picker, inline editor, polls, graphs, action bars.
   Light palette by design.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Fix: toast under sticky navbar (navbar is 68px) ── */
.toast-container {
  top: 84px !important;
  right: 20px !important;
  z-index: 1200 !important;
}
@media (max-width: 640px) {
  .toast-container { top: 78px !important; right: 10px !important; left: 10px !important; }
  .toast { max-width: none !important; }
}

/* ═══════════════════════════════════════
   REACTIONS
   ═══════════════════════════════════════ */
.reaction-bar { position: relative; align-items: center; }

.reaction-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px dashed #cbd5e1;
  font-family: inherit;
}
.reaction-add-btn:hover {
  background: #eef2ff;
  color: #4338ca;
  border-color: #a5b4fc;
}

.pfc-reaction-picker {
  position: absolute;
  z-index: 100;
  display: flex;
  gap: 4px;
  padding: 8px 10px;
  background: #fff;
  border-radius: 32px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(148, 163, 184, 0.2);
  animation: pfcPickerIn 0.18s ease;
}
@keyframes pfcPickerIn {
  from { opacity: 0; transform: translateY(6px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.pfc-reaction-pick-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  padding: 0;
  line-height: 1;
}
.pfc-reaction-pick-btn:hover {
  background: #f1f5f9;
  transform: scale(1.25);
}

/* ═══════════════════════════════════════
   MODAL SYSTEM (custom, works alongside .modal-overlay)
   ═══════════════════════════════════════ */
.pfc-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.pfc-modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.pfc-modal {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 32px 80px rgba(15, 23, 42, 0.32);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.98);
  transition: transform 0.22s ease;
}
.pfc-modal-overlay.is-open .pfc-modal { transform: translateY(0) scale(1); }
.pfc-modal-md { max-width: 620px; }
.pfc-modal-lg { max-width: 800px; }
.pfc-modal-xl { max-width: 1120px; }

.pfc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid #eef2f7;
  background: linear-gradient(135deg, #eff6ff 0%, #fef9c3 120%);
}
.pfc-modal-header h3 {
  margin: 0;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
  display: flex; align-items: center; gap: 10px;
}
.pfc-modal-close {
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  color: #64748b;
  padding: 6px 10px;
  border-radius: 8px;
}
.pfc-modal-close:hover { background: rgba(148,163,184,0.15); color: #0f172a; }

.pfc-modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  color: #0f172a;
  font-size: 14px;
  line-height: 1.55;
}
.pfc-modal-lede { color: #475569; margin: 0 0 14px; }

.pfc-modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 22px;
  border-top: 1px solid #eef2f7;
  background: #f8fafc;
}

.pfc-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.pfc-btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}
.pfc-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35); }
.pfc-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.pfc-btn-ghost {
  background: #fff;
  color: #334155;
  border: 1px solid #e2e8f0;
}
.pfc-btn-ghost:hover { background: #f1f5f9; }
.pfc-btn-sm { padding: 6px 12px; font-size: 12px; }

/* Form primitives */
.pfc-form-group { margin-bottom: 16px; }
.pfc-form-group > label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pfc-form-group input[type="text"],
.pfc-form-group input[type="url"],
.pfc-form-group input[type="number"],
.pfc-form-group select,
.pfc-form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: #0f172a;
}
.pfc-form-group input:focus,
.pfc-form-group select:focus,
.pfc-form-group textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.pfc-form-hint { font-size: 11.5px; color: #64748b; margin-top: 4px; }
.pfc-form-group .req { color: #dc2626; }
.pfc-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; }

/* Report radio grid */
.pfc-radio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}
.pfc-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
}
.pfc-radio:hover { background: #f8fafc; border-color: #cbd5e1; }
.pfc-radio input { margin: 0; }
.pfc-radio:has(input:checked) {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
}

/* ═══════════════════════════════════════
   ACTION BAR (Report / Edit / etc.)
   ═══════════════════════════════════════ */
.pfc-action-bar {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.pfc-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.pfc-action-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #e2e8f0;
}
.pfc-edit-post-btn:hover, .pfc-edit-comment-btn:hover { color: #2563eb; border-color: #bfdbfe; }
.pfc-report-btn:hover { color: #dc2626; border-color: #fecaca; }

/* Bookmark toolbar button with count */
.pfc-bookmark-btn { position: relative; }
.pfc-bookmark-btn.pfc-active {
  background: #fef3c7 !important;
  color: #92400e !important;
  border-color: #fde68a !important;
}

/* ═══════════════════════════════════════
   INLINE EDITOR
   ═══════════════════════════════════════ */
.pfc-inline-editor {
  border: 2px dashed #2563eb;
  background: #f8fbff;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 10px 0;
}
.pfc-inline-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.pfc-inline-title, .pfc-inline-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
  color: #0f172a;
  margin-bottom: 12px;
}
.pfc-inline-textarea { font-family: ui-monospace, 'Menlo', 'Consolas', monospace; font-size: 13px; line-height: 1.6; resize: vertical; min-height: 180px; }
.pfc-inline-title:focus, .pfc-inline-textarea:focus {
  outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}
.pfc-inline-actions {
  display: flex; gap: 8px; justify-content: flex-end;
}

/* ═══════════════════════════════════════
   BOOKMARKS LIST
   ═══════════════════════════════════════ */
.pfc-bookmarks-body { max-height: 60vh; }
.pfc-count-pill {
  display: inline-block;
  padding: 2px 10px;
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.pfc-empty { text-align: center; color: #64748b; padding: 40px 20px; font-size: 14px; }
.pfc-bookmark-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pfc-bookmark-item {
  padding: 14px 16px;
  border: 1px solid #eef2f7;
  border-radius: 10px;
  background: #fff;
  transition: all 0.15s ease;
}
.pfc-bookmark-item:hover { border-color: #bfdbfe; background: #f8fbff; }
.pfc-bookmark-title { display: block; font-weight: 600; color: #1e293b; font-size: 14px; text-decoration: none; }
.pfc-bookmark-title:hover { color: #2563eb; }
.pfc-bookmark-meta { font-size: 11.5px; color: #64748b; margin: 4px 0; }
.pfc-bookmark-excerpt { font-size: 13px; color: #475569; line-height: 1.5; margin-top: 6px; }

/* ═══════════════════════════════════════
   POLL SHORTCODE
   ═══════════════════════════════════════ */
.pf-poll {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 20px;
  margin: 16px 0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.pf-poll-question {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 12px;
}
.pf-poll-options { display: flex; flex-direction: column; gap: 8px; }
.pf-poll-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
  overflow: hidden;
  transition: all 0.15s ease;
}
.pf-poll-option:hover { border-color: #cbd5e1; background: #f8fafc; }
.pf-poll-option.is-voted { cursor: default; }
.pf-poll-option input { position: relative; z-index: 2; }
.pf-poll-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, rgba(37,99,235,0.14), rgba(37,99,235,0.06));
  width: 0;
  transition: width 0.6s ease;
  z-index: 1;
}
.pf-poll-option.is-voted .pf-poll-fill { display: block; }
.pf-poll-option:not(.is-voted) .pf-poll-fill { display: none; }
.pf-poll-label { position: relative; z-index: 2; flex: 1; font-size: 13.5px; color: #0f172a; font-weight: 500; }
.pf-poll-pct { position: relative; z-index: 2; font-size: 12.5px; color: #475569; font-weight: 600; }
.pf-poll-n { color: #94a3b8; font-weight: 400; }
.pf-poll-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.pf-poll-note { font-size: 12px; color: #64748b; font-style: italic; }
.pf-poll-vote-btn { padding: 6px 18px; }

/* ═══════════════════════════════════════
   GRAPH SHORTCODE + BUILDER
   ═══════════════════════════════════════ */
.pf-graph-block {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 18px;
  margin: 16px 0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.pf-graph-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
  text-align: center;
}
.pf-graph-canvas-wrap {
  position: relative;
  height: 380px;
  width: 100%;
}
.pf-graph-canvas-wrap canvas { max-width: 100%; }
.pf-graph-caption {
  margin-top: 10px;
  text-align: center;
  font-size: 12.5px;
  color: #475569;
}
.pf-graph-fit-label { display: inline-block; padding: 2px 8px; background: #f1f5f9; border-radius: 4px; }
.pf-graph-fit-eq { display: inline-block; margin-left: 8px; font-family: ui-monospace, monospace; }

/* Graph builder */
.pfc-graph-builder { min-height: 400px; }
.pfc-gb-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.pfc-gb-field { display: flex; flex-direction: column; }
.pfc-gb-field label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 4px;
}
.pfc-gb-field input, .pfc-gb-field select {
  padding: 8px 10px;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
}
.pfc-gb-table-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.pfc-gb-hint { font-size: 11.5px; color: #64748b; margin-left: auto; }
.pfc-gb-table-wrap {
  max-height: 240px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 14px;
  background: #fff;
}
.pfc-gb-table {
  width: 100%;
  border-collapse: collapse;
}
.pfc-gb-table thead th {
  position: sticky; top: 0;
  background: #f1f5f9;
  color: #1e293b;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 10px;
  text-align: center;
  border-bottom: 1px solid #e2e8f0;
}
.pfc-gb-table td {
  padding: 0;
  border-bottom: 1px solid #f1f5f9;
}
.pfc-gb-table input {
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  text-align: center;
  color: #0f172a;
}
.pfc-gb-table input:focus {
  outline: none;
  background: #eff6ff;
  box-shadow: inset 0 0 0 2px #2563eb;
}
.pfc-gb-preview-wrap {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 12px;
  min-height: 360px;
}
.pfc-gb-preview-wrap canvas { max-width: 100%; height: 320px !important; }
#pfc-gb-preview-eq { text-align: center; margin-top: 8px; font-size: 12.5px; color: #475569; }

/* Poll builder rows */
.pfc-poll-opt-row {
  display: flex; gap: 6px; margin-bottom: 6px;
}
.pfc-poll-opt-row input {
  flex: 1;
  padding: 8px 10px;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
}
.pfc-poll-opt-remove {
  background: #fee2e2;
  color: #b91c1c;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 0 12px;
  font-weight: 700;
}
.pfc-poll-opt-remove:hover { background: #fecaca; }

/* Image inserter preview */
.pfc-img-preview {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  min-height: 60px;
  background: #f8fafc;
  text-align: center;
}
.pfc-img-preview img { max-width: 100%; max-height: 220px; border-radius: 6px; }

/* ═══════════════════════════════════════
   LIVE PREVIEW panel for New Thread page
   ═══════════════════════════════════════ */
.pfc-live-preview-panel {
  position: sticky;
  top: 88px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 22px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
}
.pfc-live-preview-panel h4 {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  display: flex; align-items: center; gap: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eef2f7;
}
.pfc-live-preview-body {
  font-size: 14.5px;
  line-height: 1.65;
  color: #0f172a;
}
.pfc-live-preview-body h1, .pfc-live-preview-body h2, .pfc-live-preview-body h3 {
  color: #1e293b; margin: 12px 0 8px;
}
.pfc-live-preview-body h1 { font-size: 20px; font-weight: 700; }
.pfc-live-preview-body pre {
  background: #0f172a;
  color: #f1f5f9;
  padding: 10px 12px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 12.5px;
}
.pfc-live-preview-body code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: ui-monospace, monospace;
  font-size: 90%;
}
.pfc-live-preview-body blockquote {
  border-left: 3px solid #cbd5e1;
  padding-left: 12px;
  margin: 10px 0;
  color: #475569;
  font-style: italic;
}
.pfc-live-preview-body img { max-width: 100%; border-radius: 6px; }
.pfc-live-preview-empty {
  text-align: center;
  color: #94a3b8;
  padding: 40px 20px;
  font-style: italic;
  font-size: 13.5px;
}

/* Override new-thread-layout to 50/50 on desktop */
@media (min-width: 1024px) {
  .new-thread-layout.pfc-live-mode {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    align-items: flex-start;
  }
  .new-thread-layout.pfc-live-mode .new-thread-main,
  .new-thread-layout.pfc-live-mode .new-thread-sidebar {
    width: auto !important;
    flex: none !important;
  }
}

/* ═══════════════════════════════════════
   Simulation raw-code editor helper
   ═══════════════════════════════════════ */
.pfc-sim-code-editor {
  width: 100%;
  min-height: 460px;
  padding: 14px 16px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-family: ui-monospace, 'Menlo', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.55;
  background: #0f172a;
  color: #f1f5f9;
  resize: vertical;
  tab-size: 2;
}
.pfc-sim-code-editor:focus {
  outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.28);
}
.pfc-sim-editor-hint {
  padding: 10px 12px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 6px;
  font-size: 12.5px;
  color: #92400e;
  margin-bottom: 10px;
}

/* ═══════════════════════════════════════
   Dark-mode compatibility (light-first override)
   Users of this site prefer light UI — modals stay light regardless.
   ═══════════════════════════════════════ */
[data-theme="dark"] .pfc-modal,
[data-theme="dark"] .pfc-modal-body,
[data-theme="dark"] .pfc-modal-footer,
[data-theme="dark"] .pfc-modal-header {
  background: #fff !important;
  color: #0f172a !important;
}
[data-theme="dark"] .pfc-modal-header { background: linear-gradient(135deg, #eff6ff 0%, #fef9c3 120%) !important; }
[data-theme="dark"] .pfc-modal-footer { background: #f8fafc !important; }

/* Mobile responsiveness */
@media (max-width: 640px) {
  .pfc-modal { max-width: 100% !important; max-height: 92vh; }
  .pfc-gb-preview-wrap canvas { height: 240px !important; }
  .pf-graph-canvas-wrap { height: 300px; }
}

/* ═══════════════════════════════════════
   IMAGE placement styles (rendered from [pf_img])
   ═══════════════════════════════════════ */
.pf-img { margin: 14px 0; }
.pf-img img { display: block; border-radius: 8px; box-shadow: 0 2px 6px rgba(15,23,42,0.08); }
.pf-img figcaption {
  margin-top: 6px;
  font-size: 12.5px;
  color: #64748b;
  text-align: center;
  font-style: italic;
}
.pf-img-center { text-align: center; }
.pf-img-center img { margin: 0 auto; }
.pf-img-left  { margin-right: auto; }
.pf-img-right { margin-left: auto; text-align: right; }
.pf-img-left.pf-img-wrap {
  float: left;
  margin: 6px 18px 12px 0;
  max-width: 45%;
}
.pf-img-right.pf-img-wrap {
  float: right;
  margin: 6px 0 12px 18px;
  max-width: 45%;
}
.post-body::after, .comment-content::after,
.learn-article-content::after, .pf-katex-wrap::after {
  content: ""; display: table; clear: both;
}

/* ═══════════════════════════════════════
   Image inserter helpers
   ═══════════════════════════════════════ */
.pfc-radio-grid-3 { grid-template-columns: repeat(3, 1fr); }
.pfc-img-preview-empty { color: #94a3b8; font-style: italic; font-size: 12.5px; }
#pfc-img-progress {
  padding: 6px 10px;
  background: #eff6ff;
  border-radius: 6px;
  color: #1e40af !important;
}

/* ═══════════════════════════════════════
   HEADER user actions (bookmark + DM)
   ═══════════════════════════════════════ */
.pfc-nav-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255,255,255,0.10);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
  font-size: 18px;
}
.pfc-nav-action:hover { background: rgba(255,255,255,0.20); }
.pfc-nav-dm-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #dc2626;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
}

/* ═══════════════════════════════════════
   PROFILE — extended fields display
   ═══════════════════════════════════════ */
.pfc-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.pfc-profile-field {
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #eef2f7;
}
.pfc-profile-field .label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 4px;
}
.pfc-profile-field .value { font-size: 14px; color: #0f172a; word-break: break-word; }
.pfc-profile-field .value a { color: #2563eb; text-decoration: none; }
.pfc-profile-field .value a:hover { text-decoration: underline; }

.pfc-profile-section {
  margin: 30px 0;
  padding: 22px 26px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
}
.pfc-profile-section h2 {
  font-size: 17px;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1e293b;
}

/* Comment "edited" line */
.pfc-edited-line {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: #94a3b8;
  font-style: italic;
}

/* Post-footer edited display improvements */
.post-footer .post-edited {
  color: #94a3b8;
  font-style: italic;
  font-size: 12px;
  margin-left: 6px;
}

/* Send message button on profile */
.pfc-send-msg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #2563eb;
  color: #fff !important;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13.5px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pfc-send-msg-btn:hover { background: #1d4ed8; transform: translateY(-1px); }

/* ═══════════════════════════════════════════════════════════════════════════
   v4.8 — MESSAGES: WhatsApp/Telegram-style panel
   Default (docked): a panel on the right edge (~30vw, clamped 360–520px).
   Only ONE screen shows at a time — the conversation list, OR an open chat
   with its own profile header + back arrow — exactly like WhatsApp/Telegram
   on mobile. No cramped side-by-side split in this narrow width.
   Full screen (▸ toggle in the header): the panel expands to fill the whole
   viewport and switches to the real desktop-app layout — list column always
   visible on the left, chat on the right — like WhatsApp/Telegram Desktop.
   ═══════════════════════════════════════════════════════════════════════════ */
html.pfc-dm-open { scroll-behavior: auto; }

.pfc-dm-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  height: 100dvh;
  width: clamp(360px, 30vw, 520px);
  background: #f8fafc;
  border-left: 1px solid rgba(148,163,184,0.25);
  box-shadow: -18px 0 45px rgba(15,23,42,0.16);
  transform: translateX(103%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0.25, 1), width 0.22s ease, border-radius 0.22s ease;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  border-radius: 0;
}
.pfc-dm-panel.is-open { transform: translateX(0); }

/* Full-screen desktop mode: the panel takes over the whole viewport. */
.pfc-dm-panel.is-fullscreen {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  border-left: none;
  box-shadow: none;
}

/* scrim only ever visible below the desktop breakpoint (or fullscreen) */
.pfc-dm-scrim {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 1499;
  display: none;
}
.pfc-dm-scrim.is-open { opacity: 1; pointer-events: auto; }

.pfc-dm-panel-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid rgba(148,163,184,0.2);
}
.pfc-dm-panel-head h3 { margin: 0; font-size: 16.5px; color: #0f172a; display: flex; align-items: center; gap: 8px; }
.pfc-panel-unread-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #dc2626;
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pfc-dm-panel-actions { display: flex; gap: 6px; }
.pfc-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: rgba(148,163,184,0.12);
  color: #334155;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
}
.pfc-icon-btn:hover { background: rgba(148,163,184,0.25); color: #0f172a; text-decoration: none; }

/* ── Body: one "screens" strip holding [list][thread] side by side, only
   one of which is ever in view (translateX slides between them). ── */
.pfc-dm-body {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.pfc-dm-screens {
  display: flex;
  flex: 0 0 200%;
  width: 200%;
  height: 100%;
  transition: transform 0.26s cubic-bezier(0.32, 0.72, 0.25, 1);
  transform: translateX(0);
}
.pfc-dm-body[data-view="thread"] .pfc-dm-screens { transform: translateX(-50%); }

.pfc-dm-list {
  flex: 0 0 50%;
  width: 50%;
  min-width: 0;
  overflow-y: auto;
  border-right: 1px solid rgba(148,163,184,0.18);
  -webkit-overflow-scrolling: touch;
}
.pfc-dm-thread {
  flex: 0 0 50%;
  width: 50%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
}
[data-theme="dark"] .pfc-dm-thread { background: transparent; }

/* Full-screen desktop mode: both panes permanently visible, real columns,
   no sliding — list fixed width on the left, chat fills the rest. Scoped to
   desktop widths; below 1024px "full screen" stays single-pane (see the
   responsive block further down), so this must not apply there. */
@media (min-width: 1024px) {
  .pfc-dm-panel.is-fullscreen .pfc-dm-screens { flex: 0 0 100%; width: 100%; transform: none; }
  .pfc-dm-panel.is-fullscreen .pfc-dm-list { flex: 0 0 340px; width: 340px; }
  .pfc-dm-panel.is-fullscreen .pfc-dm-thread { flex: 1 1 auto; width: auto; }
}

.pfc-dm-loading { padding: 20px; color: #94a3b8; font-size: 13.5px; }
.pfc-dm-error { color: #dc2626; }
.pfc-dm-empty { padding: 22px 18px; color: #94a3b8; font-size: 13.5px; text-align: center; }
.pfc-dm-empty-list small { color: #94a3b8; }

.pfc-dm-item {
  position: relative;
  display: flex;
  gap: 10px;
  padding: 12px 36px 12px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(148,163,184,0.10);
  transition: background 0.12s ease;
}
.pfc-dm-item:hover { background: #eff6ff; }
.pfc-dm-item.is-active { background: #dbeafe; }
.pfc-dm-item.is-blocked { opacity: 0.65; }
.pfc-dm-item img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.pfc-dm-item-body { flex: 1; min-width: 0; }
.pfc-dm-item-top { display: flex; align-items: center; gap: 6px; font-size: 13.5px; margin-bottom: 2px; }
.pfc-dm-item-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pfc-dm-item-preview {
  font-size: 12.5px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  max-width: 100%;
}
.pfc-dm-item-meta { display: flex; gap: 8px; margin-top: 3px; font-size: 11px; color: #94a3b8; }
.pfc-dm-muted { font-size: 12px; }
.pfc-dm-item-menu {
  position: absolute;
  top: 8px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.pfc-dm-item-menu:hover { background: rgba(148,163,184,0.22); color: #0f172a; }

.pfc-dm-badge { display: inline-block; padding: 1px 7px; border-radius: 9px; font-size: 10px; font-weight: 600; }
.pfc-dm-unread {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #dc2626;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Thread header: back arrow + avatar + name, Telegram/WhatsApp style ── */
.pfc-dm-thread-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fff;
  border-bottom: 1px solid rgba(148,163,184,0.2);
}
.pfc-dm-thread-back {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #334155;
  font-size: 19px;
  border-radius: 8px;
  cursor: pointer;
}
.pfc-dm-thread-back:hover { background: rgba(148,163,184,0.18); }
/* In full-screen the list is always visible alongside — no need to navigate away. */
.pfc-dm-panel.is-fullscreen .pfc-dm-thread-back { display: none; }

.pfc-dm-thread-avatar {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
}
.pfc-dm-thread-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}
.pfc-dm-thread-who { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.pfc-dm-thread-who strong { font-size: 15px; color: #0f172a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pfc-dm-thread-sub { font-size: 12px; color: #94a3b8; text-decoration: none; }
a.pfc-dm-thread-sub:hover { text-decoration: underline; color: #2563eb; }
.pfc-dm-actions { flex: 0 0 auto; display: flex; gap: 6px; }

.pfc-dm-request-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  background: #eff6ff;
  border-bottom: 1px solid rgba(148,163,184,0.2);
  font-size: 13px;
}
.pfc-dm-request-actions { display: flex; gap: 6px; }

.pfc-dm-blocked-bar {
  flex: 0 0 auto;
  padding: 10px 14px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 13px;
  border-bottom: 1px solid rgba(148,163,184,0.2);
}

.pfc-dm-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
}
.pfc-dm-msg { max-width: 85%; align-self: flex-start; }
.pfc-dm-msg-body {
  background: #f1f5f9;
  color: #0f172a;
  padding: 9px 13px;
  border-radius: 14px 14px 14px 4px;
  font-size: 13.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.pfc-dm-msg.is-mine { align-self: flex-end; }
.pfc-dm-msg.is-mine .pfc-dm-msg-body {
  background: #2563eb;
  color: #fff;
  border-radius: 14px 14px 4px 14px;
}
.pfc-dm-msg-time { font-size: 10.5px; color: #94a3b8; margin-top: 3px; padding: 0 4px; }
.pfc-dm-msg.is-mine .pfc-dm-msg-time { text-align: right; }

/* ── Composer: large auto-growing text box + a small round send button,
   like WhatsApp/Telegram (not a wide "Send" button). ── */
.pfc-dm-composer {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid rgba(148,163,184,0.2);
}
.pfc-dm-composer textarea {
  flex: 1;
  resize: none;
  border: 1px solid rgba(148,163,184,0.35);
  border-radius: 20px;
  padding: 11px 16px;
  font-size: 14px;
  line-height: 1.4;
  min-height: 44px;
  max-height: 140px;
  background: #fff;
  color: #0f172a;
  font-family: inherit;
}
.pfc-dm-composer textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.18); }
.pfc-dm-send-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #2563eb;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.pfc-dm-send-btn:hover { background: #1d4ed8; }
.pfc-dm-send-btn:active { transform: scale(0.94); }
.pfc-dm-send-btn:disabled { opacity: 0.6; cursor: default; }
.pfc-dm-send-btn svg { transform: translateX(-1px); }

.pfc-dm-lock { flex: 0 0 auto; padding: 12px 14px; font-size: 13px; color: #64748b; background: #f8fafc; border-top: 1px solid rgba(148,163,184,0.2); }

/* context menu (Mute / Block / Delete) */
.pfc-dm-ctxmenu {
  min-width: 210px;
  background: #fff;
  border: 1px solid rgba(148,163,184,0.28);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(15,23,42,0.18);
  padding: 6px;
  z-index: 2100;
}
.pfc-dm-ctx-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: none;
  background: none;
  border-radius: 8px;
  font-size: 13.5px;
  color: #334155;
  cursor: pointer;
}
.pfc-dm-ctx-item:hover { background: #eff6ff; color: #0f172a; }
.pfc-dm-ctx-item.is-danger { color: #b91c1c; }
.pfc-dm-ctx-item.is-danger:hover { background: #fef2f2; }

/* new-message toast card */
.pfc-newmsg-toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 2200;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #0f172a;
  color: #f8fafc;
  border: none;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(15,23,42,0.3);
  cursor: pointer;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.28s ease, transform 0.28s ease;
  text-align: left;
  font-size: 13.5px;
}
.pfc-newmsg-toast.show { opacity: 1; transform: translateY(0); }
.pfc-newmsg-toast small { display: block; color: #94a3b8; font-size: 11.5px; }
.pfc-newmsg-icon { font-size: 20px; }

/* ── Responsive behaviour ── */
@media (min-width: 1024px) {
  /* desktop docked-panel: page stays interactive, no scroll lock */
  html.pfc-dm-open body { overflow: auto; }
}
@media (max-width: 1023.98px) {
  .pfc-dm-panel {
    width: 100%;
    border-left: none;
    box-shadow: none;
  }
  .pfc-dm-scrim { display: block; }
  html.pfc-dm-open body { overflow: hidden; }
  /* Below the desktop breakpoint there's no room for two real columns even
     in "full screen" — keep the single-pane list/thread navigation. */
  .pfc-dm-panel.is-fullscreen .pfc-dm-screens { flex: 0 0 200%; width: 200%; transform: translateX(0); }
  .pfc-dm-panel.is-fullscreen .pfc-dm-body[data-view="thread"] .pfc-dm-screens { transform: translateX(-50%); }
  .pfc-dm-panel.is-fullscreen .pfc-dm-list,
  .pfc-dm-panel.is-fullscreen .pfc-dm-thread { flex: 0 0 50%; width: 50%; }
  .pfc-dm-panel.is-fullscreen .pfc-dm-thread-back { display: inline-flex; }
  [data-dm-fullscreen] { display: none; }
}
