/* ============================================================
   stock2you — Professional Admin Dashboard CSS
   Bootstrap 5.3 + Bootstrap Icons 1.11.3 companion
   ============================================================ */

/* ── 1. CSS Variables + Reset ─────────────────────────────── */
:root {
  color-scheme: dark;

  /* Background layers */
  --bg:       #09152a;
  --bg2:      #0c1a32;
  --sidebar:  #0a1526;
  --card:     #0e1f38;
  --card2:    #122444;
  --border:   #1c3254;

  /* Accent palette */
  --accent:   #4f8ef7;
  --accent2:  #22d3a0;
  --accent3:  #f59e42;
  --danger:   #f4607a;

  /* Text */
  --text:     #dce8ff;
  --muted:    #6b85ab;

  /* Layout */
  --sidebar-w:  260px;
  --topbar-h:   62px;

  /* Legacy aliases used in JS-rendered HTML */
  --panel:      #0e1f38;
  --panel-2:    #122444;
  --line:       #1c3254;
  --accent-2:   #22d3a0;

  /* Shadows */
  --shadow-sm:  0 2px 8px rgba(0,0,0,.35);
  --shadow-md:  0 6px 24px rgba(0,0,0,.5);
  --shadow-lg:  0 16px 48px rgba(0,0,0,.65);

  /* Transitions */
  --t: 0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

h1,h2,h3,h4,h5,h6 { margin: 0; font-weight: 700; line-height: 1.3; }

/* ── 2. Layout Shell ──────────────────────────────────────── */
.dash-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 199;
  opacity: 0;
  transition: opacity var(--t);
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* Main area */
.dash-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  transition: margin-left var(--t);
}

/* Right rail */
.dash-rail {
  width: 380px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 20px 16px;
  background: var(--bg2);
}

.dash-content {
  flex: 1;
  min-width: 0;
  padding-bottom: 40px;
}

/* ── 3. Sidebar ───────────────────────────────────────────── */
.dash-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
  transition: transform var(--t);
}

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #06111d;
  font-weight: 800;
  font-size: 18px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.sidebar-brand h1 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.sidebar-brand p {
  font-size: 11px;
  color: var(--muted);
  margin: 2px 0 0;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav-group {
  margin-bottom: 20px;
}

.sidebar-nav-group-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 10px 8px;
}

.sidebar-nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background var(--t), color var(--t), border-color var(--t);
  position: relative;
}

.sidebar-nav-btn i {
  font-size: 17px;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}

.sidebar-nav-btn:hover {
  background: rgba(79,142,247,.1);
  color: var(--text);
}

.sidebar-nav-btn.active {
  background: rgba(79,142,247,.14);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-nav-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.sidebar-nav-btn .nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── 4. Topbar ────────────────────────────────────────────── */
.dash-topbar {
  height: var(--topbar-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

#sidebarToggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  transition: background var(--t);
  flex-shrink: 0;
}

#sidebarToggle:hover { background: rgba(255,255,255,.06); }

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  flex-shrink: 0;
}

.topbar-breadcrumb span.current {
  color: var(--text);
  font-weight: 600;
}

.topbar-breadcrumb i { font-size: 11px; }

.topbar-search {
  flex: 1;
  max-width: 380px;
  margin: 0 auto 0 16px;
  position: relative;
}

.topbar-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}

.topbar-search input {
  width: 100%;
  height: 36px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0 12px 0 36px;
  outline: none;
  font-size: 13px;
  transition: border-color var(--t), background var(--t);
}

.topbar-search input::placeholder { color: var(--muted); }
.topbar-search input:focus {
  border-color: var(--accent);
  background: rgba(79,142,247,.06);
}

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

.topbar-icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  cursor: pointer;
  transition: color var(--t), background var(--t);
}

.topbar-icon-btn:hover { color: var(--text); background: rgba(255,255,255,.06); }

.topbar-icon-btn .badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--bg2);
}

.topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #06111d;
  font-weight: 800;
  font-size: 13px;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

/* ── 5. Main Content + Views ──────────────────────────────── */
.app-view {
  display: none;
}

.app-view.active {
  display: block;
}

.content-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(9,21,42,.95);
  position: sticky;
  top: var(--topbar-h);
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  backdrop-filter: blur(6px);
}

.content-header .section-kicker {
  margin-bottom: 4px;
}

.content-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
}

.content-header p {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.section-kicker {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  margin-bottom: 6px;
}

/* ── Panel ── */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}

.panel + .panel { margin-top: 16px; }

.full-panel {
  min-height: calc(100vh - 220px);
}

/* ── 6. Community Section ─────────────────────────────────── */
.community-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  padding: 0 24px;
  gap: 0;
  flex-shrink: 0;
}

.community-tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  padding: 14px 24px;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color var(--t), border-color var(--t);
  letter-spacing: .01em;
  white-space: nowrap;
}

.community-tab:hover { color: var(--text); }

.community-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 700;
}

.ctab-panel { padding: 20px 24px; }
.ctab-panel.hidden { display: none; }

/* Composer */
.c-composer {
  display: flex;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 20px;
  transition: border-color var(--t);
}

.c-composer:focus-within {
  border-color: rgba(79,142,247,.5);
  box-shadow: 0 0 0 3px rgba(79,142,247,.08);
}

.c-composer__avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #06111d;
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.c-composer__body { flex: 1; min-width: 0; }

.c-composer__textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14.5px;
  resize: none;
  outline: none;
  min-height: 68px;
  font-family: inherit;
  line-height: 1.6;
}

.c-composer__textarea::placeholder { color: var(--muted); }

.c-composer__divider {
  height: 1px;
  background: var(--border);
  margin: 10px 0;
}

.c-composer__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.c-composer__hint { font-size: 12px; color: var(--muted); }

.c-composer__btn {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #06111d;
  border: none;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 22px;
  cursor: pointer;
  transition: opacity var(--t), transform var(--t);
  white-space: nowrap;
}

.c-composer__btn:hover { opacity: .88; transform: translateY(-1px); }
.c-composer__btn:active { transform: translateY(0); }

.c-composer__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, border-color .15s;
  flex-shrink: 0;
}
.c-composer__icon-btn:hover { color: var(--accent); border-color: var(--accent); }

.c-composer__img-preview {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: 10px;
  margin-top: 10px;
  border: 1px solid var(--border);
}

.comment-image-preview {
  margin-top: 12px;
}

.feed-image {
  margin: 4px 0 12px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.feed-image img {
  display: block;
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
  width: 100%;
}

/* Section labels */
.c-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 12px;
}

.c-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

/* Feed */
.feed-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feed-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  transition: border-color var(--t), background var(--t);
}

.feed-card:hover {
  border-color: rgba(79,142,247,.35);
  background: var(--card2);
}

.feed-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.feed-author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.member-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #06111d;
  font-weight: 800;
  font-size: 14px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.small-avatar {
  width: 32px;
  height: 32px;
  font-size: 11px;
}

.feed-author strong { font-size: 14px; font-weight: 600; }
.post-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Feed card preview */
.feed-card-preview {
  cursor: pointer;
  padding: 4px 0;
}
.feed-card-preview:hover .feed-post-title { color: var(--accent); }

.feed-post-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 8px 0 4px;
  line-height: 1.4;
  transition: color var(--t);
}

.feed-excerpt {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.6;
  margin: 4px 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-thumb {
  margin: 8px 0;
  border-radius: 8px;
  overflow: hidden;
  max-height: 200px;
}
.feed-thumb img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

/* Post detail modal */
.post-detail-modal { width: min(820px, 100%); max-height: calc(100vh - 48px); overflow-y: auto; }
.post-detail-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.modal-close-inline {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  display: grid;
  place-items: center;
  transition: background var(--t), color var(--t);
}
.modal-close-inline:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

.post-detail-bottom-close {
  display: flex;
  justify-content: flex-end;
  padding-top: 20px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}
.modal-close-bottom {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.modal-close-bottom:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.post-detail-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 10px 0 14px;
  line-height: 1.35;
}
.post-detail-actions {
  display: flex;
  gap: 8px;
  padding: 12px 0;
}
.post-detail-divider {
  border-top: 1px solid var(--border);
  margin: 16px 0 14px;
}

.feed-content {
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 8px 0 12px;
  color: var(--text);
}

.feed-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 10px;
}

.feed-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: color var(--t), background var(--t), border-color var(--t);
  white-space: nowrap;
}

.feed-action:hover {
  color: var(--text);
  background: rgba(255,255,255,.05);
  border-color: var(--muted);
}

.feed-action.active {
  color: var(--accent);
  border-color: rgba(79,142,247,.35);
  background: rgba(79,142,247,.1);
}

.feed-action.liked {
  color: #f58aa0;
  border-color: rgba(245, 138, 160, .35);
  background: rgba(245, 138, 160, .12);
}

.feed-action.liked:hover {
  color: #ffb1c1;
  border-color: rgba(255, 177, 193, .5);
  background: rgba(245, 138, 160, .18);
}

/* Following filter bar */
.following-filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.following-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 18px;
  cursor: pointer;
  transition: all var(--t);
}

.following-filter:hover { color: var(--text); border-color: var(--muted); }

.following-filter.active {
  background: rgba(79,142,247,.12);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.ffilter-panel { }
.ffilter-panel.hidden { display: none; }

/* Stock chips grid */
.stock-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  padding: 4px 0;
}

.stock-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 10px 12px;
  cursor: pointer;
  transition: border-color var(--t), background var(--t), transform var(--t);
}

.stock-chip:hover {
  border-color: var(--accent);
  background: rgba(79,142,247,.06);
  transform: translateY(-2px);
}

.stock-chip__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent2);
}

.stock-chip__symbol {
  font-weight: 800;
  font-size: 15px;
  color: var(--text);
  letter-spacing: .04em;
}

.stock-chip__label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  text-align: center;
}

/* Member cards */
.member-card-list { display: flex; flex-direction: column; gap: 10px; }

.member-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  transition: border-color var(--t);
}

.member-card:hover { border-color: rgba(79,142,247,.35); }

.member-card__avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #06111d;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.member-card__info { flex: 1; min-width: 0; }
.member-card__name { font-weight: 600; font-size: 13.5px; }
.member-card__handle { font-size: 12px; color: var(--muted); margin-top: 1px; }

.member-card__btn {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 100px;
  padding: 5px 14px;
  background: transparent;
  cursor: pointer;
  transition: background var(--t), color var(--t);
  white-space: nowrap;
}

.member-card__btn:hover { background: var(--accent); color: #06111d; }

/* ── 7. Scanner Section ───────────────────────────────────── */
.scanner-layout {
  display: block;
  padding-bottom: 24px;
}

.scanner-main { min-width: 0; }

.scanner-control-panel {
  margin: 20px 24px 16px;
}

.scanner-control-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.preset-select-group {
  flex-shrink: 0;
  width: 260px;
}

.preset-select-group label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.preset-select {
  width: 100%;
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  cursor: pointer;
  font-size: 13.5px;
  transition: border-color var(--t);
  appearance: auto;
}

.preset-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,142,247,.12);
}

.custom-filter-panel {
  flex: 1;
  min-width: 0;
  border-left: 1px solid var(--border);
  padding-left: 20px;
}

.custom-filter-panel.hidden { display: none; }
.custom-filter-panel .section-kicker { margin-bottom: 8px; }

.filter-builder { display: grid; gap: 8px; }

.inline-filter-builder {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-inputs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.filter-inputs-row select,
.filter-inputs-row input {
  flex: 1;
  min-width: 88px;
  max-width: 155px;
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
  outline: none;
  font-size: 13px;
  transition: border-color var(--t);
}

.filter-inputs-row select:focus,
.filter-inputs-row input:focus {
  border-color: var(--accent);
}

/* Schema banner */
#schemaBanner {
  margin: 0 24px 12px;
  color: var(--muted);
  font-size: 13px;
}

/* Summary Cards */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin: 0 24px 16px;
}

.summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  border-top: 3px solid var(--accent);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--t), transform var(--t);
  position: relative;
  overflow: hidden;
}

.summary-card:hover { transform: translateY(-2px); }

.summary-card::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 16px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(79,142,247,.12);
}

.summary-card h3 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.summary-card p {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.summary-card .trend {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
}

.trend.up { background: rgba(34,211,160,.14); color: var(--accent2); }
.trend.down { background: rgba(244,96,122,.14); color: var(--danger); }
.trend.neutral { background: rgba(107,133,171,.14); color: var(--muted); }

/* Strategy explanation */
.strategy-panel-wrap {
  margin: 0 24px 16px;
}

.strategy-panel {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
}

/* Strategy panel — filter rules */
.sp-header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:2px; }
.sp-confidence { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.06em;
                 padding:2px 7px; border-radius:20px; margin-left:8px; vertical-align:middle; }
.sp-conf-high   { background:rgba(34,211,160,.15); color:#22d3a0; }
.sp-conf-medium { background:rgba(245,158,66,.15);  color:#f59e42; }
.sp-conf-low    { background:rgba(244,96,122,.15);  color:#f4607a; }
.sp-section-label { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.07em;
                    color:var(--muted); margin-bottom:8px; }
.sp-rules { display:flex; flex-wrap:wrap; gap:8px; }
.sp-rule-chip { display:inline-flex; align-items:center; gap:6px;
                background:var(--bg2); border:1px solid var(--border);
                border-radius:8px; padding:6px 12px; font-size:12px; }
.sp-rule-metric { color:var(--text); font-weight:600; }
.sp-rule-op { font-weight:700; font-size:13px; }
.sp-rule-val { color:#e8f0ff; font-weight:700; font-size:13px; }
.sp-load-btn { background:rgba(60,169,244,.12); border:1px solid rgba(60,169,244,.3);
               color:var(--accent); border-radius:8px; padding:6px 14px; font-size:12px;
               font-weight:600; cursor:pointer; white-space:nowrap; transition:all .15s;
               display:flex; align-items:center; gap:6px; flex-shrink:0; }
.sp-load-btn:hover { background:rgba(60,169,244,.2); }
.sp-load-btn:disabled { opacity:.5; cursor:default; }

/* Restore strategy button (in active filters row) */
.filter-restore-btn { display:inline-flex; align-items:center; gap:5px;
  background:rgba(245,158,66,.1); border:1px solid rgba(245,158,66,.3);
  color:#f59e42; border-radius:20px; padding:4px 12px; font-size:11px; font-weight:600;
  cursor:pointer; white-space:nowrap; transition:all .15s; margin-left:4px; }
.filter-restore-btn:hover { background:rgba(245,158,66,.2); }

/* Strategy Fit */
.strategy-fit-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.strategy-fit-name { font-weight: 600; font-size: 14px; }

.confidence-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.confidence-high   { background: rgba(34,211,160,.15); color: #22d3a0; }
.confidence-medium { background: rgba(245,158,66,.15);  color: var(--accent3); }
.confidence-low    { background: rgba(244,96,122,.15);   color: var(--danger); }

.strategy-fit-summary {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 10px;
  line-height: 1.45;
}

/* Results panel */
.results-panel {
  margin: 0 24px;
}

.results-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.sort-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.sort-controls label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.sort-controls select {
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--t);
}

.sort-controls select:focus { border-color: var(--accent); }

.results-meta {
  font-size: 12.5px;
  color: var(--muted);
}

/* Table */
.table-scroll-nav {
  display: flex;
  align-items: stretch;
  gap: 0;
  position: relative;
}

.table-scroll-btn {
  flex-shrink: 0;
  width: 32px;
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t), color var(--t);
  z-index: 2;
}

.table-scroll-btn--left {
  border-radius: 8px 0 0 8px;
  border-right: none;
}

.table-scroll-btn--right {
  border-radius: 0 8px 8px 0;
  border-left: none;
}

.table-scroll-btn:hover { background: var(--accent); color: #fff; }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  flex: 1;
  min-width: 0;
  border-radius: 4px;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

th, td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
  font-size: 13px;
}

th {
  background: #0b1829;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  position: sticky;
  top: 0;
  z-index: 3;
}

/* Sticky first two columns */
th:nth-child(1), td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 110px;
}

th:nth-child(2), td:nth-child(2) {
  position: sticky;
  left: 110px;
  z-index: 1;
  min-width: 100px;
  overflow: visible;
}

th:nth-child(1), th:nth-child(2) {
  background: #0b1829;
  z-index: 4;
}

td:nth-child(1), td:nth-child(2) {
  background: var(--card);
}

tbody tr:hover td:nth-child(1),
tbody tr:hover td:nth-child(2) {
  background: var(--card2);
}

td:nth-child(2)::after, th:nth-child(2)::after {
  content: '';
  position: absolute;
  top: 0;
  right: -8px;
  bottom: 0;
  width: 8px;
  background: linear-gradient(to right, rgba(9,21,42,.3), transparent);
  pointer-events: none;
}

tbody tr:hover { background: rgba(79,142,247,.07); }

tbody tr:last-child td { border-bottom: none; }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

#pageIndicator {
  font-size: 13px;
  color: var(--muted);
  min-width: 80px;
  text-align: center;
}

/* Active filters */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(79,142,247,.1);
  border: 1px solid rgba(79,142,247,.3);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--accent);
}

.filter-chip button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  transition: color var(--t);
}

.filter-chip button:hover { color: var(--danger); }

/* ── 8. Notifications Section ─────────────────────────────── */
.notification-panel {
  margin: 20px 24px;
}

.notification-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  transition: background var(--t), border-color var(--t);
  cursor: default;
}

.notification-item:hover {
  background: var(--card2);
  border-color: var(--border);
}

.notification-item.unread {
  background: rgba(79,142,247,.06);
  border-color: rgba(79,142,247,.15);
}

.notification-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(79,142,247,.12);
  color: var(--accent);
  font-size: 16px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.notification-body { flex: 1; min-width: 0; }

.notification-body strong { font-size: 13.5px; font-weight: 600; }

.notification-body p {
  font-size: 12.5px;
  color: var(--muted);
  margin: 2px 0 0;
  line-height: 1.45;
}

.notification-time {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Mini notification list (rail) */
.mini-list .notification-item {
  padding: 12px 14px;
  gap: 14px;
}

.mini-list .notification-body strong {
  display: block;
  font-size: 14px;
  line-height: 1.35;
}

.mini-list .notification-body p {
  display: -webkit-box;
  margin-top: 4px;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mini-list .notification-time {
  font-size: 11.5px;
  padding-top: 2px;
}

/* ── 9. Profile Section ───────────────────────────────────── */
.profile-panel {
  margin: 20px 24px;
}

.profile-summary {
  display: grid;
  gap: 14px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
}

.profile-stat {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.profile-stat strong {
  display: block;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 2px;
}

.profile-name {
  font-weight: 700;
  font-size: 18px;
}

.profile-muted {
  color: var(--muted);
  font-size: 13px;
}

/* Compact (sidebar) profile summary */
.compact-summary .profile-grid {
  grid-template-columns: 1fr;
}

.compact-summary .profile-stat strong { font-size: 18px; }

/* Sidebar footer profile */
.sidebar-footer .profile-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.sidebar-footer .profile-mini .member-avatar {
  width: 34px;
  height: 34px;
  font-size: 12px;
  flex-shrink: 0;
}

.sidebar-footer .profile-mini-info { flex: 1; min-width: 0; }
.sidebar-footer .profile-mini-info strong { font-size: 13px; display: block; }
.sidebar-footer .profile-mini-info span { font-size: 11px; color: var(--muted); }

/* ── 10. Modals ───────────────────────────────────────────── */
/* Custom modals (detailModal, commentModal) — scoped by ID to avoid Bootstrap conflict */
#detailModal, #commentModal, #newPostModal, #postDetailModal, #editModal {
  position: fixed;
  inset: 0;
  background: rgba(4,8,16,.78);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 300;
  backdrop-filter: blur(4px);
}

#detailModal.hidden, #commentModal.hidden, #newPostModal.hidden, #postDetailModal.hidden, #editModal.hidden { display: none; }

.modal-panel {
  width: min(1100px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #0b1828;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.social-modal {
  width: min(780px, 100%);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  display: grid;
  place-items: center;
  transition: background var(--t), color var(--t);
  z-index: 2;
}

.modal-close:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 16px;
}

.comment-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.comment-item:last-child { border-bottom: none; }

.comment-content {
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-image {
  margin-top: 10px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.comment-image img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  width: 100%;
}

.comment-composer {
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.composer-input {
  width: 100%;
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  outline: none;
  resize: vertical;
  min-height: 90px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color var(--t);
}

.composer-input::placeholder { color: var(--muted); }
.composer-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,142,247,.1);
}

/* ── 11. Stock Detail (stock.html) ────────────────────────── */
.stock-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.stock-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 20px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  transition: color var(--t);
}

.stock-back:hover { color: var(--text); }

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

.stock-header h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.stock-header p {
  color: var(--muted);
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.stock-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 32px;
}

.stock-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}

.stock-card h3 {
  margin: 0 0 16px;
  font-size: 16px;
}

.discussion-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
}

.discussion-section h3 {
  margin: 0 0 20px;
  font-size: 17px;
}

.discussion-composer {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.discussion-composer textarea {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 14px;
  resize: none;
  height: 80px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--t);
}

.discussion-composer textarea:focus { border-color: var(--accent); }
.discussion-composer textarea::placeholder { color: var(--muted); }

.post-btn {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #06111d;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity var(--t);
}

.post-btn:disabled { opacity: .6; cursor: not-allowed; }
.post-btn:hover:not(:disabled) { opacity: .88; }

.discussion-list { display: flex; flex-direction: column; gap: 1px; }

.discussion-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.discussion-item:last-child { border-bottom: none; }

.discussion-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.discussion-meta strong { font-size: 14px; }
.discussion-meta .username { color: var(--muted); font-size: 13px; }
.discussion-meta .time { color: var(--muted); font-size: 12px; margin-left: auto; }

.discussion-content {
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.delete-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  transition: color var(--t);
}

.delete-btn:hover { color: var(--danger); }

.no-discussion {
  color: var(--muted);
  text-align: center;
  padding: 32px 0;
  font-size: 14px;
}

.loading-state {
  color: var(--muted);
  text-align: center;
  padding: 40px;
}

/* ── 12. Auth Pages ───────────────────────────────────────── */
.auth-page {
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

/* Split layout */
.auth-split {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.auth-brand-panel {
  flex: 0 0 420px;
  background: linear-gradient(145deg, #071220 0%, #0d1f3c 50%, #091528 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 48px;
  position: relative;
  overflow: hidden;
}

.auth-brand-panel::before {
  content: '';
  position: absolute;
  top: -120px;
  right: -120px;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79,142,247,.18) 0%, transparent 70%);
  pointer-events: none;
}

.auth-brand-panel::after {
  content: '';
  position: absolute;
  bottom: -80px;
  left: -80px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34,211,160,.12) 0%, transparent 70%);
  pointer-events: none;
}

.auth-brand-top .brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 48px;
}

.auth-brand-top .brand-mark {
  width: 50px;
  height: 50px;
  font-size: 22px;
  border-radius: 12px;
}

.auth-brand-top .brand-title h1 {
  font-size: 22px;
  margin: 0;
}

.auth-brand-top .brand-title p {
  font-size: 12px;
  color: var(--muted);
  margin: 3px 0 0;
}

.auth-brand-headline h2 {
  font-size: 28px;
  line-height: 1.35;
  margin-bottom: 14px;
  background: linear-gradient(135deg, var(--text), rgba(220,232,255,.65));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-brand-headline p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.auth-brand-features {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 32px;
}

.auth-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.auth-feature i {
  font-size: 18px;
  color: var(--accent2);
  flex-shrink: 0;
}

.auth-brand-footer {
  font-size: 11px;
  color: rgba(107,133,171,.6);
  z-index: 1;
}

/* Right form panel */
.auth-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  overflow-y: auto;
}

.auth-card {
  width: 100%;
  max-width: 440px;
}

.auth-card-header {
  margin-bottom: 28px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  display: block;
  margin-bottom: 8px;
}

.auth-card-header h2 {
  font-size: 24px;
  margin-bottom: 6px;
}

.auth-card-header p {
  color: var(--muted);
  font-size: 13.5px;
}

/* Register card (wider) */
.auth-form-panel.wide .auth-card {
  max-width: 560px;
}

/* Form fields */
.field-group {
  margin-bottom: 16px;
}

.field-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.field-group input {
  width: 100%;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 11px 14px;
  outline: none;
  font-size: 14px;
  transition: border-color var(--t), background var(--t);
}

.field-group input::placeholder { color: var(--muted); }
.field-group input:focus {
  border-color: var(--accent);
  background: rgba(79,142,247,.06);
  box-shadow: 0 0 0 3px rgba(79,142,247,.1);
}

.field-error {
  font-size: 12px;
  color: var(--danger);
  margin: 4px 0 0;
}

.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 8px;
  user-select: none;
}

.checkbox-row input[type=checkbox] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.form-message {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 16px;
  border: 1px solid;
}

.form-message.success {
  background: rgba(34,211,160,.1);
  border-color: rgba(34,211,160,.3);
  color: var(--accent2);
}

.form-message.error {
  background: rgba(244,96,122,.1);
  border-color: rgba(244,96,122,.3);
  color: var(--danger);
}

.form-message.hidden { display: none; }

.auth-switch {
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
  text-align: center;
}

.auth-switch a { color: var(--accent); font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }

.auth-footnote {
  font-size: 12px;
  color: rgba(107,133,171,.7);
  text-align: center;
  margin-top: 16px;
  line-height: 1.55;
}

/* ── 13. Component Library ────────────────────────────────── */

/* Buttons */
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #6fa8ff);
  color: #06111d;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 18px;
  cursor: pointer;
  transition: opacity var(--t), transform var(--t);
  white-space: nowrap;
}

.primary-btn:hover { opacity: .88; transform: translateY(-1px); }
.primary-btn:active { transform: translateY(0); }
.primary-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background var(--t), border-color var(--t), color var(--t);
  white-space: nowrap;
}

.ghost-btn:hover {
  background: rgba(255,255,255,.06);
  border-color: var(--muted);
}

.wide-btn { width: 100%; }

.compact-btn {
  padding: 6px 12px;
  font-size: 12.5px;
}

/* Spinner inside button */
.btn-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(6,17,29,.4);
  border-top-color: #06111d;
  animation: spin .7s linear infinite;
  display: inline-block;
}

.btn-spinner.hidden { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 8px;
  border: 1px solid rgba(34,211,160,.24);
  background: rgba(34,211,160,.12);
  color: var(--accent2);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-danger {
  border-color: rgba(244,96,122,.24);
  background: rgba(244,96,122,.12);
  color: var(--danger);
}

.badge-warn {
  border-color: rgba(245,158,66,.24);
  background: rgba(245,158,66,.12);
  color: var(--accent3);
}

.badge-primary {
  border-color: rgba(79,142,247,.24);
  background: rgba(79,142,247,.12);
  color: var(--accent);
}

/* Follow button */
.follow-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: transparent;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t), color var(--t), border-color var(--t);
  white-space: nowrap;
}

.follow-btn:hover {
  background: rgba(79,142,247,.15);
  border-color: var(--accent);
}

.follow-btn--active {
  background: rgba(244,96,122,.1);
  border-color: rgba(244,96,122,.35);
  color: var(--danger);
}

.follow-btn--active:hover {
  background: rgba(244,96,122,.2);
  border-color: var(--danger);
}

/* Table link button */
.table-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 65px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(79,142,247,.1);
  color: var(--text);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
}

.table-link-btn:hover {
  background: rgba(79,142,247,.2);
  border-color: var(--accent);
}

/* Forms */
.search-input,
.filter-builder input,
.filter-builder select {
  width: 100%;
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  font-size: 13.5px;
  transition: border-color var(--t);
}

.search-input:focus,
.filter-builder input:focus,
.filter-builder select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,142,247,.1);
}

/* Inline message */
.inline-message { font-size: 13px; }
.inline-message.hidden { display: none; }
.inline-message.success { color: var(--accent2); }
.inline-message.error   { color: var(--danger); }

/* Empty state */
.empty-state {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

.empty-state i {
  font-size: 32px;
  display: block;
  margin-bottom: 10px;
  opacity: .5;
}

/* Hidden utility */
.hidden { display: none !important; }

/* Row tooltip */
.row-tooltip {
  position: fixed;
  z-index: 500;
  max-width: 420px;
  max-height: min(70vh, 720px);
  overflow: auto;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(7,14,26,.97);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}

.row-tooltip.hidden { display: none; }
.row-tooltip-header { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 10px; }
.row-tooltip-company { margin-bottom: 12px; color: var(--muted); }
.row-tooltip-section + .row-tooltip-section { margin-top: 10px; }
.row-tooltip-section h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .06em; }
.row-tooltip-section p { margin: 0; color: var(--muted); font-size: 13px; }
.row-tooltip-section ul { margin: 0; padding-left: 16px; display: grid; gap: 4px; }
.row-tooltip-section li span { color: var(--muted); }
.row-tooltip-section li.pass { color: var(--accent2); }
.row-tooltip-section li.fail { color: var(--danger); }

/* Detail modal grid */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 16px;
}

.detail-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  padding: 18px;
  overflow: hidden;
  text-align: left;
}

.detail-card h3 {
  text-align: left;
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
}

.detail-card ul {
  margin: 8px 0 0;
  padding-left: 20px;
  list-style: disc;
}

.detail-card ul li {
  padding-left: 6px;
  margin-bottom: 4px;
  font-size: 13px;
}

/* Mini table */
.mini-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  font-size: 13.5px;
  table-layout: auto;
}

.mini-table td {
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  position: static;
  white-space: normal;
  min-width: 0;
}

.mini-table td:first-child {
  color: var(--muted);
  position: static;
  left: auto;
  min-width: 0;
}

.mini-table td:nth-child(2) {
  position: static;
  left: auto;
  min-width: 0;
}

.mini-table td:last-child {
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}

.mini-table tr:last-child td { border-bottom: none; }

/* Score bars */
.score-table td.score-label { color: var(--muted); font-size: 12px; width: 64px; }
.score-table td.score-bar-cell { padding: 6px 8px; }

.score-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}

.score-bar-fill {
  height: 100%;
  background: var(--accent2);
  border-radius: 3px;
  transition: width .3s ease;
}

.score-table td:last-child {
  text-align: right;
  font-weight: 600;
  font-size: 13px;
  width: 40px;
}

/* Dividend table */
.div-th {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 4px 4px 8px;
  border-bottom: 1px solid var(--border);
}

.div-th-right { text-align: right; }

.muted-text { color: var(--muted); font-size: 13px; }

/* Rail panel */
.rail-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
}

.rail-panel h3 {
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--text);
}

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

/* ── 14. Utilities ────────────────────────────────────────── */
.text-muted { color: var(--muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--accent2); }
.text-danger { color: var(--danger); }
.fw-700 { font-weight: 700; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }

/* ── Board / Webboard UI ──────────────────────────────────── */

.board-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.board-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 180px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  transition: border-color var(--t);
}
.board-search-wrap:focus-within { border-color: var(--accent); }
.board-search-icon { color: var(--muted); font-size: 13px; flex-shrink: 0; }
.board-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13.5px;
  padding: 9px 0;
}
.board-search-input::placeholder { color: var(--muted); }

.board-sort-select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  outline: none;
  min-width: 110px;
}
.board-sort-select:focus { border-color: var(--accent); }

/* Feed toolbar */
.c-feed-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.c-feed-search {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13.5px;
  padding: 8px 14px;
  outline: none;
}
.c-feed-search:focus { border-color: var(--accent); }
.c-feed-sort {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  cursor: pointer;
}
.c-feed-sort:focus { border-color: var(--accent); }

/* Tag filter row */
.tag-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.tag-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(79,142,247,.15);
  border: 1px solid rgba(79,142,247,.4);
  color: var(--accent);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12.5px;
  font-weight: 500;
}
.tag-filter-remove {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 0 0 2px;
}

/* Post tags on card */
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 10px;
}
.post-tag {
  display: inline-block;
  background: rgba(34,211,160,.1);
  border: 1px solid rgba(34,211,160,.3);
  color: #22d3a0;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
}
.post-tag:hover { background: rgba(34,211,160,.2); }

/* New Post Modal */
.new-post-modal { width: min(720px, 100%); }

.post-title-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--t);
  display: block;
}
.post-title-input::placeholder { color: var(--muted); font-weight: 400; font-size: 16px; }
.post-title-input:focus { border-color: var(--accent); }

/* Tag input */
.tag-input-section { margin-bottom: 12px; }
.tag-input-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  min-height: 40px;
  cursor: text;
  transition: border-color var(--t);
}
.tag-input-wrap:focus-within { border-color: var(--accent); }
.tag-chips-row { display: flex; flex-wrap: wrap; gap: 5px; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(79,142,247,.15);
  border: 1px solid rgba(79,142,247,.35);
  color: var(--accent);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 500;
}
.tag-chip-remove {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
  opacity: .7;
}
.tag-chip-remove:hover { opacity: 1; }
.tag-bare-input {
  flex: 1;
  min-width: 120px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
}
.tag-bare-input::placeholder { color: var(--muted); }
.tag-input-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Quill editor dark theme overrides */
.quill-editor-wrap .ql-toolbar.ql-snow {
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}
.quill-editor-wrap .ql-container.ql-snow {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  font-family: inherit;
  font-size: 14px;
}
.quill-editor-wrap .ql-editor {
  min-height: 140px;
  color: var(--text);
  line-height: 1.65;
}
.comment-composer .quill-editor-wrap .ql-editor { min-height: 90px; }
.quill-editor-wrap .ql-editor.ql-blank::before {
  color: var(--muted);
  font-style: normal;
}
.quill-editor-wrap .ql-snow .ql-stroke { stroke: var(--muted); }
.quill-editor-wrap .ql-snow .ql-fill { fill: var(--muted); }
.quill-editor-wrap .ql-snow .ql-picker { color: var(--muted); }
.quill-editor-wrap .ql-snow .ql-picker-options {
  background: var(--bg2);
  border-color: var(--border);
  color: var(--text);
}
.quill-editor-wrap .ql-toolbar.ql-snow .ql-formats button:hover .ql-stroke,
.quill-editor-wrap .ql-toolbar.ql-snow .ql-formats button.ql-active .ql-stroke { stroke: var(--accent); }
.quill-editor-wrap .ql-toolbar.ql-snow .ql-formats button:hover .ql-fill,
.quill-editor-wrap .ql-toolbar.ql-snow .ql-formats button.ql-active .ql-fill { fill: var(--accent); }
.quill-editor-wrap .ql-toolbar.ql-snow .ql-formats .ql-picker-label:hover,
.quill-editor-wrap .ql-toolbar.ql-snow .ql-formats .ql-picker-label.ql-active { color: var(--accent); }
.quill-editor-wrap .ql-editor blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  color: var(--muted);
  margin: 8px 0;
}
.quill-editor-wrap .ql-editor pre.ql-syntax {
  background: rgba(0,0,0,.3);
  color: #22d3a0;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
}
.quill-editor-wrap .ql-editor img {
  max-width: 100%;
  border-radius: 6px;
  margin: 6px 0;
}
.quill-editor-wrap .ql-editor a { color: var(--accent); }

/* Read-only rich content in feed cards */
.feed-content.ql-editor-readonly {
  white-space: normal;
  padding: 0;
}
.feed-content.ql-editor-readonly p { margin: 0 0 6px; }
.feed-content.ql-editor-readonly blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 10px;
  color: var(--muted);
  margin: 6px 0;
}
.feed-content.ql-editor-readonly pre {
  background: rgba(0,0,0,.3);
  color: #22d3a0;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12.5px;
  overflow-x: auto;
}
.feed-content.ql-editor-readonly img { max-width: 100%; border-radius: 6px; margin: 4px 0; }
.feed-content.ql-editor-readonly a { color: var(--accent); }
.feed-content.ql-editor-readonly ul, .feed-content.ql-editor-readonly ol {
  padding-left: 20px; margin: 4px 0;
}

/* Comment HTML content */
.comment-content.ql-editor-readonly {
  white-space: normal;
  font-size: 14px;
  line-height: 1.6;
}
.comment-content.ql-editor-readonly p { margin: 0 0 4px; }
.comment-content.ql-editor-readonly img { max-width: 100%; border-radius: 4px; }

/* ── 15. Responsive ───────────────────────────────────────── */

/* 1400px — hide right rail */
@media (max-width: 1400px) {
  .dash-rail { display: none; }
}

/* 1100px — topbar toggle visible */
@media (max-width: 1100px) {
  #sidebarToggle { display: flex; }

  .dash-sidebar {
    transform: translateX(-100%);
  }

  .dash-sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .dash-main {
    margin-left: 0;
  }

  .topbar-breadcrumb { display: none; }
}

/* 768px */
@media (max-width: 768px) {
  .content-header {
    padding: 16px 16px 14px;
    flex-direction: column;
    align-items: flex-start;
  }

  .content-header h2 { font-size: 18px; }

  .ctab-panel { padding: 16px; }

  .scanner-control-panel { margin: 16px 16px 12px; }
  .summary-grid { margin: 0 16px 12px; grid-template-columns: 1fr 1fr; }
  .results-panel { margin: 0 16px; }
  .notification-panel { margin: 16px; }
  .profile-panel { margin: 16px; }
  .strategy-panel-wrap { margin: 0 16px 12px; }

  .scanner-control-row { flex-direction: column; }
  .preset-select-group { width: 100%; }
  .custom-filter-panel { border-left: none; padding-left: 0; border-top: 1px solid var(--border); padding-top: 14px; }

  .results-toolbar { flex-direction: column; align-items: flex-start; }
  .sort-controls { flex-wrap: wrap; }

  .detail-grid { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr 1fr; }

  .stock-grid { grid-template-columns: 1fr; }
  .stock-page { padding: 16px; }

  .auth-brand-panel { display: none; }
  .auth-split { min-height: 100vh; }
  .two-column { grid-template-columns: 1fr; }

  .topbar-search { max-width: 200px; }

  .community-tabs { padding: 0 16px; }
  .community-tab { padding: 12px 16px; font-size: 13px; }
}

/* 480px */
@media (max-width: 480px) {
  .summary-grid { grid-template-columns: 1fr; margin: 0 12px 12px; }
  .scanner-control-panel { margin: 12px; }
  .results-panel { margin: 0 12px; }
  .notification-panel { margin: 12px; }
  .profile-panel { margin: 12px; }
  .strategy-panel-wrap { margin: 0 12px 12px; }
  #schemaBanner { margin: 0 12px 8px; }

  .ctab-panel { padding: 12px; }

  .filter-inputs-row select,
  .filter-inputs-row input {
    max-width: 100%;
    min-width: 120px;
  }

  .topbar-search { display: none; }
  .dash-topbar { padding: 0 14px; }

  .auth-form-panel { padding: 24px 16px; }
  .auth-card-header h2 { font-size: 20px; }

  .modal { padding: 12px; }
  .modal-panel { padding: 16px; }

  .community-tab { padding: 10px 12px; }

  .profile-grid { grid-template-columns: 1fr; }

  /* scrape view on mobile */
  #view-scrape [style*="grid-template-columns:1fr 420px"] {
    grid-template-columns: 1fr !important;
  }
  #view-scrape [style*="grid-template-columns:repeat(4,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ── Scrape Control view components ──────────────────────────────────────── */
.sc-status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 20px; font-size: 13px; font-weight: 700;
  letter-spacing: .01em;
}
.sc-idle                       { background: rgba(255,255,255,.07); color: var(--muted); }
.sc-running                    { background: rgba(34,211,160,.18);  color: #22d3a0; border: 1px solid rgba(34,211,160,.3); }
.sc-completed                  { background: rgba(79,142,247,.15);  color: #4f8ef7; }
.sc-interrupted                { background: rgba(244,96,122,.15);  color: var(--danger); }
.sc-completed_with_failures    { background: rgba(245,158,66,.15);  color: #f59e42; }

.sc-pulse {
  width: 7px; height: 7px; border-radius: 50%; background: currentColor;
  animation: scPulse 1.2s ease-in-out infinite;
}
@keyframes scPulse { 0%,100%{opacity:1} 50%{opacity:.25} }
@keyframes sc-spin  { to { transform: rotate(360deg); } }

.sc-filter-pill {
  padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 600;
  border: 1px solid var(--border); background: transparent;
  color: var(--muted); cursor: pointer; transition: all .15s;
}
.sc-filter-pill:hover  { border-color: rgba(79,142,247,.4); color: #4f8ef7; }
.sc-filter-pill.active { background: rgba(79,142,247,.15); border-color: rgba(79,142,247,.4); color: #4f8ef7; }

/* ── Scrape file-path row ─────────────────────────────────────────────────── */
.sc-file-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 12px;
  /* grows to fill remaining space in the action bar */
  flex: 1 1 400px; min-width: 0;
}
.sc-file-icon { color: var(--muted); font-size: 14px; flex-shrink: 0; }
.sc-file-input {
  flex: 1 1 0; min-width: 0;          /* fills all available space in the row */
  background: transparent; border: none; outline: none;
  color: var(--text); font-size: 12px; font-family: 'Consolas', 'Courier New', monospace;
}
.sc-file-input::placeholder { color: var(--muted); }
.sc-file-count {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 700; color: #22d3a0;
  background: rgba(34,211,160,.12); border-radius: 5px;
  padding: 2px 8px; white-space: nowrap; flex-shrink: 0;
}
.sc-browse-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px; font-size: 12px; font-weight: 600;
  border-radius: 7px; flex-shrink: 0;
}
@media (max-width: 900px) {
  #view-scrape .sc-actions { flex-direction: column; align-items: stretch; }
  .sc-file-row { flex-wrap: wrap; }
  .sc-file-input { min-width: 0; }
}

/* ── Admin User Management ──────────────────────────────────────────────── */
.au-th {
  padding: 9px 14px; text-align: left; font-size: 10px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
  background: var(--bg2); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; white-space: nowrap;
}
.au-action-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px;
  border: 1px solid var(--border); background: transparent;
  color: var(--muted); font-size: 13px; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.au-action-btn:hover      { background: rgba(255,255,255,.06); color: var(--text); }
.au-approve:hover         { background: rgba(34,211,160,.15);  color: #22d3a0; border-color: rgba(34,211,160,.3); }
.au-revoke:hover          { background: rgba(245,158,66,.15);  color: #f59e42; border-color: rgba(245,158,66,.3); }
.au-suspend:hover,
.au-delete:hover          { background: rgba(244,96,122,.15);  color: #f4607a; border-color: rgba(244,96,122,.3); }
.au-activate:hover        { background: rgba(79,142,247,.15);  color: #4f8ef7; border-color: rgba(79,142,247,.3); }

/* ── Pantip-style comment threads ──────────────────────────────────── */
.comment-item {
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  border-left: 4px solid transparent;
  background: var(--card);
}
/* Post owner comment — blue */
.comment-theme-owner {
  border-left-color: #3b82f6;
  background: rgba(59,130,246,.07);
}
/* Top-level member reply — dark gray */
.comment-theme-root {
  border-left-color: #64748b;
  background: rgba(100,116,139,.07);
}
/* Member-to-member sub-reply — lighter */
.comment-theme-sub {
  border-left-color: #94a3b8;
  background: rgba(148,163,184,.05);
  margin-left: 24px;
}
/* Most-liked comment — purple */
.comment-theme-top {
  border-left-color: #a855f7;
  background: rgba(168,85,247,.09);
}

.comment-head {
  margin-top: 8px;
}

.comment-author {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.comment-author-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.comment-author-meta strong {
  display: inline-block;
  line-height: 1.25;
}

.comment-meta {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

.comment-num-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  padding: 1px 7px;
  border-radius: 20px;
  margin-right: 6px;
  vertical-align: middle;
  background: rgba(255,255,255,.08);
  color: var(--muted);
}
.comment-theme-owner .comment-num-badge { background: rgba(59,130,246,.2); color: #93c5fd; }
.comment-theme-root  .comment-num-badge { background: rgba(100,116,139,.25); color: #cbd5e1; }
.comment-theme-sub   .comment-num-badge { background: rgba(148,163,184,.15); color: #cbd5e1; }
.comment-theme-top   .comment-num-badge { background: rgba(168,85,247,.2); color: #d8b4fe; }

.owner-badge {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  padding: 1px 7px; border-radius: 20px;
  background: rgba(59,130,246,.2); color: #93c5fd;
  margin-left: 5px; vertical-align: middle;
}
.top-badge {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  padding: 1px 7px; border-radius: 20px;
  background: rgba(168,85,247,.22); color: #d8b4fe;
  margin-left: 5px; vertical-align: middle;
}

.comment-reply-to {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
  opacity: .8;
}

.reply-btn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500;
  padding: 2px 10px; border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent; color: var(--muted);
  cursor: pointer; transition: background .15s, color .15s;
  margin-top: 6px;
}
.reply-btn:hover { background: rgba(255,255,255,.06); color: var(--text); }

/* Reply-to bar above comment composer */
.reply-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px;
  border-radius: 8px 8px 0 0;
  background: rgba(59,130,246,.12);
  border: 1px solid rgba(59,130,246,.25);
  border-bottom: none;
  font-size: 12px; font-weight: 500; color: #93c5fd;
  margin-bottom: 0;
}
.reply-bar.hidden { display: none; }
.reply-bar-cancel {
  background: none; border: none; color: #93c5fd;
  font-size: 18px; line-height: 1; cursor: pointer;
  padding: 0 2px; opacity: .7; transition: opacity .15s;
}
.reply-bar-cancel:hover { opacity: 1; }

.comment-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

/* Unified edit / delete action buttons (posts & comments) */
.content-action-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 500;
  border: 1px solid var(--border); background: transparent;
  color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.edit-comment-btn:hover, .edit-post-btn:hover {
  background: rgba(59,130,246,.12); color: #93c5fd; border-color: rgba(59,130,246,.3);
}
.delete-comment-btn:hover, .delete-post-btn:hover {
  background: rgba(244,96,122,.12); color: #f4607a; border-color: rgba(244,96,122,.3);
}
.comment-footer { gap: 8px; }
.comment-like-btn:hover {
  background: rgba(244,114,182,.12);
  color: #f472b6;
  border-color: rgba(244,114,182,.35);
}
.comment-like-btn.liked {
  background: rgba(244,114,182,.14);
  color: #f472b6;
  border-color: rgba(244,114,182,.4);
}
.feed-card-owner-actions { display: flex; gap: 6px; margin-left: auto; }

/* Inline edit form */
.edit-comment-form { margin-top: 8px; }
.edit-comment-textarea {
  width: 100%; min-height: 72px; padding: 8px 10px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 13px;
  resize: vertical; outline: none;
  transition: border-color .15s;
}
.edit-comment-textarea:focus { border-color: var(--accent); }
