/* profiles_directory.css — Profiles page (theme variables, so light and dark both work) */
#view-profiles.pdir-active > .intel-panel-card,
#view-profiles.pdir-active > #full-profiles-grid,
#view-profiles.pdir-active > #monitored-profiles-pagination { display: none !important; }

.pdir { padding: 16px 20px; color: var(--text-primary, #111); }
.pdir-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.pdir-title { margin: 0; font-size: 18px; font-weight: 600; }
.pdir-muted { font-size: 12px; color: var(--text-muted, #6b7280); }
.pdir-tools { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 12px; }
.pdir-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pdir-pill { padding: 5px 11px; font-size: 12px; border: 1px solid var(--border-subtle, rgba(0,0,0,0.12)); border-radius: 999px; background: transparent; color: var(--text-secondary, #4b5563); cursor: pointer; }
.pdir-pill.active { background: var(--accent-primary, #4f83f1); border-color: var(--accent-primary, #4f83f1); color: #fff; }
.pdir-count { opacity: 0.8; font-variant-numeric: tabular-nums; }
.pdir-input { padding: 7px 10px; font-size: 13px; border: 1px solid var(--border-subtle, rgba(0,0,0,0.15)); border-radius: 8px; background: var(--bg-input, var(--bg-card, #fff)); color: var(--text-primary, #111); min-width: 200px; max-width: 100%; box-sizing: border-box; font-family: inherit; }
textarea.pdir-input { width: 100%; resize: vertical; }
.pdir-btn { padding: 6px 12px; font-size: 12px; border: 1px solid var(--border-medium, rgba(0,0,0,0.2)); border-radius: 8px; background: transparent; color: var(--text-primary, #111); cursor: pointer; }
.pdir-btn:disabled { opacity: 0.5; cursor: default; }
.pdir-primary { background: var(--accent-primary, #4f83f1); border-color: var(--accent-primary, #4f83f1); color: #fff; }
.pdir-danger { border-color: #dc2626; color: #dc2626; }
.pdir-body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.pdir-left, .pdir-right { min-width: 0; }
.pdir-right { position: sticky; top: 8px; padding: 12px 14px; border: 1px solid var(--border-subtle, rgba(0,0,0,0.12)); border-radius: 12px; background: var(--bg-card, #fff); max-height: calc(100vh - 40px); overflow: auto; }
.pdir-list { display: flex; flex-direction: column; border: 1px solid var(--border-subtle, rgba(0,0,0,0.12)); border-radius: 12px; overflow: hidden; background: var(--bg-card, #fff); }
.pdir-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; text-align: left; border: 0; border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.08)); background: transparent; color: inherit; cursor: pointer; font-family: inherit; }
.pdir-row:last-child { border-bottom: 0; }
.pdir-row:hover, .pdir-row:focus-visible { background: var(--bg-elevated, rgba(0,0,0,0.04)); outline: none; }
.pdir-row.active { background: var(--bg-accent, rgba(79,131,241,0.12)); }
.pdir-av { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; background: var(--bg-elevated, rgba(0,0,0,0.06)); color: var(--text-secondary, #4b5563); position: relative; overflow: hidden; }
.pdir-av-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.pdir-av-initials { display: inline-flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.pdir-av-lg { width: 48px; height: 48px; min-width: 48px; font-size: 15px; }
.pdir-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.pdir-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdir-name-lg { font-size: 16px; font-weight: 700; white-space: normal; line-height: 1.3; }
.pdir-verified { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%; background: #1d9bf0; color: #fff; font-size: 9px; font-weight: bold; margin-left: 4px; vertical-align: middle; line-height: 1; }
.pdir-plat-chip { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; background: var(--bg-elevated, rgba(0,0,0,0.06)); color: var(--text-secondary, #4b5563); margin-left: 4px; vertical-align: middle; }
.pdir-bio-wrap { margin: 8px 0; }
.pdir-bio { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text-primary, #111); word-break: break-word; white-space: pre-line; }
.pdir-bio-clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.pdir-bio-toggle { background: none; border: none; padding: 2px 0; margin-top: 2px; font-size: 11px; font-weight: 600; color: var(--accent-primary, #4f83f1); cursor: pointer; }
.pdir-bio-toggle:hover { text-decoration: underline; }
.pdir-links { margin: 6px 0 10px; font-size: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.pdir-ext-link { color: var(--accent-primary, #4f83f1); text-decoration: none; word-break: break-all; }
.pdir-ext-link:hover { text-decoration: underline; }
.pdir-dot { color: var(--text-muted, #9ca3af); }
.pdir-stats-card { margin: 10px 0 12px; padding: 10px 12px; border: 1px solid var(--border-subtle, rgba(0,0,0,0.1)); border-radius: 10px; background: var(--bg-elevated, rgba(0,0,0,0.02)); }
.pdir-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.pdir-stat-num { font-size: 15px; font-weight: 700; color: var(--text-primary, #111); font-variant-numeric: tabular-nums; }
.pdir-stat-lbl { font-size: 11px; color: var(--text-muted, #6b7280); text-transform: uppercase; letter-spacing: 0.3px; margin-top: 2px; }
.pdir-stat-asof { margin-top: 6px; font-size: 11px; color: var(--text-muted, #6b7280); text-align: center; }
.pdir-attribution-note { margin: 4px 0 8px; font-size: 11px; color: var(--text-muted, #6b7280); font-style: italic; }
.pdir-sub { font-size: 11px; color: var(--text-muted, #6b7280); }
.pdir-meta { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.pdir-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.pdir-b-mon { background: rgba(22,163,74,0.15); color: #15803d; }
.pdir-b-pin { background: rgba(79,131,241,0.15); color: #1d4ed8; }
.pdir-b-dir { background: rgba(107,114,128,0.15); color: var(--text-secondary, #4b5563); }
.pdir-b-flag { background: rgba(220,38,38,0.12); color: #b91c1c; }
.pdir-pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; }
.pdir-state { padding: 16px; font-size: 13px; color: var(--text-secondary, #4b5563); }
.pdir-err { color: #b91c1c; }
.pdir-empty { text-align: center; }
.pdir-box { margin-top: 12px; border: 1px solid var(--border-subtle, rgba(0,0,0,0.12)); border-radius: 12px; overflow: hidden; background: var(--bg-card, #fff); }
.pdir-box-title { padding: 8px 12px; font-size: 13px; font-weight: 600; }
.pdir-detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pdir-back { display: none; }
.pdir-dl { margin: 0 0 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.pdir-kv { min-width: 0; }
.pdir-kv dt { font-size: 11px; color: var(--text-muted, #6b7280); }
.pdir-kv dd { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.pdir-act { margin: 8px 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.pdir-label { font-size: 12px; color: var(--text-secondary, #4b5563); }
.pdir-note { margin: 8px 0; padding: 7px 10px; border-radius: 8px; font-size: 12px; }
.pdir-note-ok { background: rgba(22,163,74,0.12); color: #15803d; }
.pdir-note-err { background: rgba(220,38,38,0.1); color: #991b1b; }
.pdir-post { padding: 9px 0; border-top: 1px solid var(--border-subtle, rgba(0,0,0,0.1)); }
.pdir-post-time { font-size: 12px; font-weight: 600; }
.pdir-post-text { margin: 3px 0; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.pdir-post-meta { font-size: 12px; color: var(--text-muted, #6b7280); }
.pdir-post-meta a { color: var(--accent-primary, #4f83f1); }
@media (max-width: 1000px) {
  .pdir-body { grid-template-columns: minmax(0, 1fr); }
  .pdir-right { position: static; max-height: none; }
  .pdir-body.pdir-has-detail .pdir-left { display: none; }
  .pdir-body:not(.pdir-has-detail) .pdir-right { display: none; }
  .pdir-back { display: inline-block; }
  .pdir { padding: 12px; }
}

/* Phones: name on the first line, status and collection on the second, so names are not cut */
@media (max-width: 600px) {
  .pdir-row { flex-wrap: wrap; row-gap: 4px; }
  .pdir-name { white-space: normal; overflow-wrap: anywhere; }
  .pdir-meta { flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: center; text-align: left; margin-left: 42px; gap: 4px 8px; }
  .pdir-head .pdir-btn { width: 100%; }
  .pdir-input { min-width: 0; width: 100%; }
  .pdir-dl { grid-template-columns: minmax(0, 1fr); }
  .pdir-pager { justify-content: center; }
}

/* Refresh live button & gated data badges */
.pdir-btn-refresh {
  margin-left: auto;
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 11px;
  padding: 5px 10px;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid var(--border-medium, rgba(0,0,0,0.18));
  background: var(--bg-card, #fff);
  color: var(--text-primary, #111);
  transition: all 0.15s ease;
}
.pdir-btn-refresh:hover:not(:disabled) {
  background: var(--bg-elevated, rgba(0,0,0,0.05));
  border-color: var(--accent-primary, #4f83f1);
  color: var(--accent-primary, #4f83f1);
}
.pdir-btn-refresh.loading {
  opacity: 0.7;
  cursor: wait;
}
.pdir-btn-refresh.success {
  border-color: rgba(22,163,74,0.4);
  color: #15803d;
  background: rgba(22,163,74,0.06);
}
.pdir-btn-refresh.cooldown {
  opacity: 0.75;
  color: #b45309;
  border-color: rgba(217,119,6,0.3);
}
.pdir-btn-refresh.error {
  border-color: rgba(220,38,38,0.4);
  color: #dc2626;
}
.pdir-stat-gated {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted, #6b7280);
  font-style: italic;
  display: block;
  line-height: 1.2;
}
.pdir-posts-gated {
  color: var(--text-muted, #6b7280);
  font-style: italic;
}


/* Phones: Refresh button is a full-width, finger-sized button under the name so the name is not squeezed */
@media (max-width: 600px) {
  .pdir-detail-head { flex-wrap: wrap; }
  .pdir-btn-refresh { order: 99; flex: 1 1 100%; margin-left: 0; min-height: 44px; font-size: 14px; padding: 10px 14px; white-space: normal; }
}

/* Bulk pin / unpin */
.pdir-rowwrap { display: flex; align-items: stretch; border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.08)); }
.pdir-rowwrap:last-child { border-bottom: 0; }
.pdir-rowwrap .pdir-row { flex: 1 1 auto; min-width: 0; border-bottom: 0; width: auto; }
.pdir-rowwrap.selected { background: var(--bg-accent, rgba(79,131,241,0.08)); }
.pdir-chk { display: flex; align-items: center; justify-content: center; padding: 0 4px 0 12px; cursor: pointer; }
.pdir-chk input, .pdir-chk-all input { width: 18px; height: 18px; cursor: pointer; }
.pdir-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 12px; border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.08)); }
.pdir-chk-all { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.pdir-bulk-btns { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.pdir-bulk-skip { flex: 1 1 100%; font-size: 12px; }
@media (max-width: 600px) {
  .pdir-chk { padding-left: 14px; padding-right: 8px; min-width: 44px; }
  .pdir-bulk-btns { margin-left: 0; width: 100%; }
  .pdir-bulk-btns .pdir-btn { flex: 1 1 30%; min-height: 44px; }
}

.pdir-head-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
@media (max-width: 600px) { .pdir-head-btns { width: 100%; justify-content: stretch; } .pdir-head-btns .pdir-btn { flex: 1 1 100%; min-height: 44px; } }

/* Link to the profile on the platform itself */
.pdir-rowlink { display: flex; align-items: center; justify-content: center; min-width: 40px; padding: 0 10px; font-size: 16px; text-decoration: none; color: var(--accent-blue, #2563EB); border-left: 1px solid var(--border-subtle, rgba(0,0,0,0.08)); }
.pdir-rowlink:hover, .pdir-rowlink:focus-visible { background: var(--bg-elevated, rgba(0,0,0,0.05)); outline: none; }
@media (max-width: 600px) { .pdir-rowlink { min-width: 44px; } }
