/* ── Light theme overrides ────────────────────────────────────────────────────── */
:root.theme-light {
  --bg:          #f1f5f9;
  --bg-nav:      #ffffff;
  --bg-card:     #ffffff;
  --bg-item:     #f8fafc;
  --text:        #1e293b;
  --text-muted:  #64748b;
  --red:         #b91c1c;
  --green:       #15803d;
  --teal-bright: #0f766e;
  --border:      rgba(100,116,139,0.25);
  --shadow:      0 4px 20px rgba(0,0,0,0.12);
}
:root.theme-light .news-item a    { color: #b91c1c; }
:root.theme-light .news-item a:hover { color: #dc2626; }
:root.theme-light .news-full-list a { color: #b91c1c; }

/* ── Reduced-motion support ───────────────────────────────────────────────────── */
.reduced-motion .ticker-list,
.reduced-motion .announce-ticker span {
  animation-play-state: paused !important;
}
@media (prefers-reduced-motion: reduce) {
  .ticker-list, .announce-ticker span { animation-play-state: paused !important; }
}

/* ── Inbox badge ──────────────────────────────────────────────────────────────── */
.nav-inbox { position: relative; }
.inbox-badge {
  position: absolute; top: -6px; right: -10px;
  background: var(--red, #f87171); color: #fff;
  border-radius: 10px; font-size: var(--fs-065); font-weight: 700;
  padding: 1px 5px; min-width: 16px; text-align: center; pointer-events: none;
}

/* ── Content Viewer Modal ─────────────────────────────────────────────────────── */
.cv-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 1100; backdrop-filter: blur(2px);
}
.cv-modal {
  position: fixed; inset: 0; z-index: 1101;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.cv-modal-inner {
  background: var(--bg-card, #12171d); border: 1px solid var(--border);
  border-radius: 10px; width: min(92vw, 900px); height: min(88vh, 800px);
  display: flex; flex-direction: column; overflow: hidden;
  pointer-events: all; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: cv-fade-in 0.18s ease;
}
@keyframes cv-fade-in { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform: none; } }
.cv-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-10) var(--sp-14); border-bottom: 1px solid var(--border);
  background: var(--bg-nav, #0f141a); flex-shrink: 0;
}
.cv-title {
  font-size: var(--fs-088); font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%;
}
.cv-header-actions { display: flex; align-items: center; gap: var(--sp-8); }
.cv-newtab-btn {
  font-size: var(--fs-075); color: var(--teal-bright, #3aafba); text-decoration: none;
  padding: 3px var(--sp-8); border: 1px solid currentColor; border-radius: 4px; white-space: nowrap;
}
.cv-newtab-btn:hover { background: rgba(45,212,191,0.1); }
.cv-close-btn {
  background: none; border: none; color: var(--text-muted);
  font-size: var(--fs-100); cursor: pointer; padding: 2px var(--sp-6); border-radius: 4px;
}
.cv-close-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.cv-modal-body { flex: 1; overflow: hidden; position: relative; }
.cv-loading {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: var(--text-muted); font-size: var(--fs-090);
}
.cv-iframe { width: 100%; height: 100%; border: none; }
.cv-extracted {
  padding: 20px 24px; overflow-y: auto; height: 100%;
  color: var(--text); font-size: var(--fs-090); line-height: 1.6;
}
.cv-extracted h1,.cv-extracted h2,.cv-extracted h3 { margin: 1em 0 0.4em; color: var(--text); }
.cv-extracted p { margin: 0 0 0.9em; }
.cv-extracted a { color: var(--teal-bright, #3aafba); }
.cv-source-attr { font-size: var(--fs-075); color: var(--text-muted); margin-bottom: 16px; }
.cv-fallback {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; gap: var(--sp-14); color: var(--text-muted); font-size: var(--fs-090);
}
.cv-opentab-btn { font-size: var(--fs-085); }
@media (max-width: 600px) {
  .cv-modal-inner { width: 100vw; height: 100vh; border-radius: 0; }
}

/* ── Compose message modal ────────────────────────────────────────────────────── */
.cv-compose-modal {
  position: fixed; inset: 0; z-index: 1102;
  display: flex; align-items: center; justify-content: center; pointer-events: none;
}
.cv-compose-inner {
  background: var(--bg-card, #12171d); border: 1px solid var(--border);
  border-radius: 10px; width: min(92vw, 460px); pointer-events: all;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.cv-compose-textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: var(--fs-088);
  padding: var(--sp-8) var(--sp-10); resize: vertical; box-sizing: border-box;
}
.cv-compose-textarea:focus { outline: none; border-color: var(--teal-bright); }

/* ── Comment breadcrumb ───────────────────────────────────────────────────────── */
.comment-breadcrumb {
  display: block; font-size: 0.71rem; color: var(--text-muted);
  margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.comment-item-link { color: var(--teal-bright, #3aafba); text-decoration: underline; font-size: 0.71rem; }
.comment-meta-row { display: flex; align-items: center; gap: var(--sp-6); flex-wrap: wrap; }
.comment-msg-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: var(--fs-080); padding: 0 4px; border-radius: 4px;
}
.comment-msg-btn:hover { background: rgba(255,255,255,0.08); color: var(--teal-bright); }

/* ── User Comments ticker arrow (used in feed rows outside the ticker) ─────────── */
.cti-arrow {
  color: var(--teal-bright, #3aafba);
  font-size: var(--fs-085); text-decoration: none; flex-shrink: 0; padding: 0 2px;
}
.cti-arrow:hover { color: #fff; }

/* ── Inbox page ───────────────────────────────────────────────────────────────── */
.inbox-layout {
  display: flex; gap: 0; height: calc(100vh - 120px); min-height: 400px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; margin: 16px auto; max-width: 900px;
}
.inbox-sidebar {
  width: 260px; flex-shrink: 0; border-right: 1px solid var(--border); overflow-y: auto;
}
.inbox-sidebar-header {
  padding: 12px var(--sp-14); border-bottom: 1px solid var(--border);
  font-size: var(--fs-082); font-weight: 600; color: var(--text-muted);
  display: flex; align-items: center; justify-content: space-between;
}
.inbox-conv-item {
  padding: var(--sp-10) var(--sp-14); border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer; transition: background 0.15s;
}
.inbox-conv-item:hover,.inbox-conv-item.active { background: rgba(45,212,191,0.06); }
.inbox-conv-name { font-size: var(--fs-085); font-weight: 600; color: var(--text); }
.inbox-conv-preview { font-size: var(--fs-075); color: var(--text-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-unread-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--teal-bright); margin-right: 4px;
}
.inbox-thread { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.inbox-thread-header {
  padding: var(--sp-10) 16px; border-bottom: 1px solid var(--border);
  font-size: var(--fs-085); font-weight: 600; color: var(--text);
}
.inbox-messages {
  flex: 1; overflow-y: auto; padding: 12px 16px;
  display: flex; flex-direction: column; gap: var(--sp-8);
}
.inbox-msg {
  max-width: 75%; padding: var(--sp-8) 12px; border-radius: 8px;
  font-size: var(--fs-085); line-height: 1.5;
}
.inbox-msg.mine   { align-self: flex-end; background: rgba(45,212,191,0.15); color: var(--text); }
.inbox-msg.theirs { align-self: flex-start; background: rgba(255,255,255,0.07); color: var(--text); }
.inbox-msg-meta { font-size: var(--fs-070); color: var(--text-muted); margin-top: 3px; }
.inbox-compose {
  padding: var(--sp-10) var(--sp-14); border-top: 1px solid var(--border);
  display: flex; gap: var(--sp-8); align-items: flex-end;
}
.inbox-compose textarea {
  flex: 1; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: var(--fs-085);
  padding: 7px var(--sp-10); resize: none;
}
.inbox-compose textarea:focus { outline: none; border-color: var(--teal-bright); }

/* Inbox: new-message search */
.inbox-new-btn {
  background: none;
  border: 1px solid var(--teal-bright, #3aafba);
  border-radius: 4px;
  color: var(--teal-bright, #3aafba);
  cursor: pointer;
  font-size: var(--fs-072);
  padding: 3px var(--sp-8);
}
.inbox-new-btn:hover,
.inbox-new-btn:focus-visible {
  background: rgba(45, 212, 191, 0.1);
  outline: none;
}
.inbox-search-wrap {
  border-bottom: 1px solid var(--border);
  padding: var(--sp-6) var(--sp-10);
  position: relative;
}
.inbox-search-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  box-sizing: border-box;
  color: var(--text);
  font-size: var(--fs-080);
  padding: var(--sp-6) 9px;
  width: 100%;
}
.inbox-search-input:focus {
  border-color: var(--teal-bright);
  outline: none;
}
.inbox-search-results {
  background: var(--bg-nav);
  border: 1px solid var(--border);
  border-radius: 0 0 6px 6px;
  left: 10px;
  max-height: 180px;
  overflow-y: auto;
  position: absolute;
  right: 10px;
  top: calc(100% - 1px);
  z-index: 300;
}
.inbox-search-result {
  cursor: pointer;
  font-size: var(--fs-080);
  padding: 7px 12px;
}
.inbox-search-result:hover,
.inbox-search-result:focus-visible {
  background: rgba(45, 212, 191, 0.08);
  outline: none;
}
.inbox-conv-name {
  align-items: center;
  display: flex;
  gap: 4px;
  min-width: 0;
}
.inbox-conv-ts {
  color: var(--text-muted);
  font-size: var(--fs-065);
  font-weight: 400;
  margin-left: auto;
  white-space: nowrap;
}
.inbox-conv-badge {
  border: 1px solid rgba(122, 133, 146, 0.3);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.63rem;
  font-weight: 500;
  padding: 0 5px;
  white-space: nowrap;
}
.inbox-load-more {
  padding: var(--sp-6) 0 var(--sp-10);
  text-align: center;
}
.inbox-load-more button {
  background: none;
  border: 1px solid var(--teal-bright, #3aafba);
  border-radius: 4px;
  color: var(--teal-bright, #3aafba);
  cursor: pointer;
  font-size: var(--fs-072);
  padding: 3px 12px;
}
.inbox-load-more button:hover,
.inbox-load-more button:focus-visible {
  background: rgba(45, 212, 191, 0.08);
  outline: none;
}
@media (max-width: 640px) {
  .inbox-layout { flex-direction: column; height: auto; }
  .inbox-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); max-height: 200px; }
}

/* ── Admin dashboard ──────────────────────────────────────────────────────────── */
.admin-wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.admin-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: var(--sp-18); flex-wrap: wrap; }
.admin-tab {
  padding: var(--sp-8) 16px; font-size: var(--fs-082); border-radius: 6px 6px 0 0;
  color: var(--text-muted); text-decoration: none; background: none; border: none; cursor: pointer;
}
.admin-tab:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.admin-tab.active { color: var(--teal-bright); border-bottom: 2px solid var(--teal-bright); }
.admin-stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.admin-stat {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: var(--sp-14) 16px;
}
.admin-stat-label { font-size: var(--fs-072); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.admin-stat-value { font-size: 1.6rem; font-weight: 700; color: var(--teal-bright); margin-top: 4px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: var(--fs-080); }
.admin-table th {
  text-align: left; padding: var(--sp-8) var(--sp-10); background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--border); color: var(--text-muted); font-weight: 600;
}
.admin-table td { padding: 7px var(--sp-10); border-bottom: 1px solid rgba(255,255,255,0.04); color: var(--text); }
.admin-table tr:hover td { background: rgba(255,255,255,0.03); }
.admin-action-btn {
  font-size: var(--fs-072); padding: 2px var(--sp-8); border-radius: 4px; cursor: pointer;
  border: 1px solid var(--border); background: none; color: var(--text-muted); margin: 0 2px;
}
.admin-action-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
  .admin-pager { display: flex; gap: var(--sp-8); justify-content: center; margin-top: var(--sp-14); }
  .admin-moderation-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
  }
  .admin-panel {
    border: 1px solid var(--border); background: var(--bg-card);
    border-radius: 8px; padding: 12px; min-width: 0;
  }
  .admin-panel-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--sp-8); margin-bottom: var(--sp-10);
  }
  .admin-panel-head h3, .admin-subhead {
    margin: 0; font-size: 0.86rem; color: var(--teal-bright);
  }
  .admin-panel-head span {
    color: var(--text-muted); font-size: 0.74rem; text-transform: uppercase;
  }
  .admin-clip {
    max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .admin-action-btn.active { color: var(--teal-bright); border-color: var(--teal-bright); }
  .admin-message-summary {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-8); margin-bottom: var(--sp-14);
  }
  .admin-message-summary div {
    border: 1px solid var(--border); border-radius: 6px;
    padding: var(--sp-10); background: rgba(255,255,255,0.03);
  }
  .admin-message-summary b {
    display: block; color: var(--teal-bright); font-size: 1.2rem;
  }
  .admin-message-summary span { color: var(--text-muted); font-size: var(--fs-072); }

/* ── Task 1/4: Content Viewer drag/resize/pin ────────────────────────────────── */
.cv-drag-hint { cursor: grab; color: var(--text-muted); font-size: var(--fs-100); user-select: none; margin-right: var(--sp-6); }
.cv-modal-header { cursor: default; }
.cv-unblur-btn, .cv-pin-btn {
  background: none; border: 1px solid var(--border); border-radius: 4px;
  color: var(--text-muted); font-size: var(--fs-072); padding: 3px var(--sp-8); cursor: pointer;
}
.cv-unblur-btn:hover, .cv-pin-btn:hover { color: var(--text); border-color: var(--teal); }
.cv-resize-handle {
  position: absolute; bottom: 0; right: 0; width: 18px; height: 18px;
  cursor: se-resize;
  background: linear-gradient(135deg, transparent 50%, var(--teal) 50%);
  border-radius: 0 0 var(--radius) 0;
}
.cv-modal-inner { position: absolute; }
.cv-pin-pill { font-size: var(--fs-075); background: var(--bg-card); border: 1px solid var(--teal); color: var(--teal-bright); }

/* ── Task 6: Inbox text label ────────────────────────────────────────────────── */
.nav-inbox .inbox-badge { margin-left: 3px; }

/* ── Task 7: Profile popup ───────────────────────────────────────────────────── */
.profile-popup {
  position: fixed; inset: 0; z-index: 1200; pointer-events: none;
}
.profile-popup-inner {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 300px; max-height: 480px; overflow: hidden;
  background: var(--bg-nav); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  pointer-events: all;
}
.profile-popup-header {
  display: flex; align-items: center; gap: var(--sp-10);
  padding: 12px var(--sp-14); border-bottom: 1px solid var(--border);
  cursor: grab; user-select: none; flex-shrink: 0;
}
.profile-popup-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--fs-100); color: #fff; flex-shrink: 0;
}
.profile-popup-info { flex: 1; min-width: 0; }
.profile-popup-name { font-weight: 700; font-size: var(--fs-088); }
.profile-popup-online { font-size: var(--fs-072); color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.pp-online-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; }
.profile-popup-body { overflow-y: auto; flex: 1; padding: 12px var(--sp-14); }
.pp-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-8); margin-bottom: 12px; }
.pp-stat { background: var(--bg-card); border-radius: 6px; padding: var(--sp-8); text-align: center; }
.pp-stat-label { font-size: var(--fs-065); color: var(--text-muted); text-transform: uppercase; }
.pp-stat-val { font-size: var(--fs-088); font-weight: 700; color: var(--teal-bright); margin-top: 2px; }
.pp-section-title { font-size: var(--fs-072); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin: var(--sp-10) 0 var(--sp-6); }
.pp-comments { display: flex; flex-direction: column; gap: var(--sp-6); }
.pp-comment-item { background: var(--bg-item); border-radius: 6px; padding: 7px 9px; font-size: var(--fs-078); }
.pp-comment-bc { color: var(--teal-bright); font-size: var(--fs-070); margin-bottom: 2px; }
.pp-comment-body { color: var(--text); }
.pp-actions { margin-top: 12px; display: flex; gap: var(--sp-8); }
.clickable-username { cursor: pointer; color: var(--teal-bright); text-decoration: underline; text-underline-offset: 2px; }
.clickable-username:hover { color: var(--teal-hover); }

/* ── Task 8: User posts ──────────────────────────────────────────────────────── */
.user-post-entry {
  background: var(--bg-item); border-radius: var(--radius); padding: 12px var(--sp-14);
  margin-bottom: var(--sp-10); border: 1px solid var(--border);
}
.user-post-meta { font-size: var(--fs-072); color: var(--text-muted); margin-bottom: var(--sp-6); }
.user-post-body { font-size: var(--fs-088); color: var(--text); white-space: pre-wrap; word-break: break-word; margin-bottom: var(--sp-8); }
.user-post-actions { display: flex; gap: var(--sp-8); }
