/* ═══════════════════════════════════════════════
   Soup — Dark social-network theme
   ═══════════════════════════════════════════════ */

:root {
  --bg:           #000000;
  --bg-surface:   #16181c;
  --bg-hover:     #1d1f23;
  --bg-input:     #202327;
  --border:       #2f3336;
  --border-light: #1f2125;
  --text:         #e7e9ea;
  --text-muted:   #71767b;
  --accent:       #1d9bf0;
  --accent-hover: #1a8cd8;
  --accent-dim:   rgba(29,155,240,.15);
  --like:         #f91880;
  --like-dim:     rgba(249,24,128,.15);
  --success:      #00ba7c;
  --warning:      #f7931a;
  --danger:       #f4212e;
  --radius:       12px;
  --radius-sm:    8px;
  --radius-full:  9999px;
  --font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  --nav-w:        240px;
  --right-w:      320px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

button { cursor: pointer; font-family: inherit; border: none; background: none; }

input, select, textarea {
  font-family: inherit;
  font-size: 15px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  outline: none;
  width: 100%;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
select option { background: var(--bg-surface); }
textarea { resize: vertical; min-height: 80px; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ═══════════════════════════════════════════════
   Layout
   ═══════════════════════════════════════════════ */

.app-layout {
  display: flex;
  min-height: 100vh;
  max-width: 1260px;
  margin: 0 auto;
}

.nav-rail {
  width: var(--nav-w);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
}

#main-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
}

.nav-brand {
  padding: 8px 12px 16px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.nav-brand a { color: var(--text); }

.nav-links { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-full);
  color: var(--text);
  font-size: 17px;
  font-weight: 500;
  transition: background .15s;
}
.nav-link:hover { background: var(--bg-hover); }
.nav-link.active { font-weight: 700; }
.nav-link.active .nav-icon { color: var(--accent); }
.nav-icon { font-size: 20px; width: 24px; text-align: center; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-full);
  margin-top: auto;
  transition: background .15s;
}
.nav-user:hover { background: var(--bg-hover); }
.nav-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}
.nav-user-name { font-weight: 700; font-size: 14px; }
.nav-user-meta { font-size: 12px; color: var(--text-muted); }
.nav-auth-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 4px;
  margin-top: auto;
}

.main-content {
  flex: 1;
  min-width: 0;
  max-width: 700px;
  border-right: 1px solid var(--border);
}

.right-rail {
  width: var(--right-w);
  padding: 16px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.page-header h1 { font-size: 20px; font-weight: 800; }
.page-header-sub { font-size: 13px; color: var(--text-muted); }

/* ═══════════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 15px;
  transition: background .15s, opacity .15s;
  cursor: pointer;
  border: none;
  white-space: nowrap;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-sm { padding: 5px 14px; font-size: 13px; }
.btn-xs { padding: 3px 10px; font-size: 12px; }

.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: #d0d0d0; }

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

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg-hover); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: rgba(244,33,46,.1); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: .88; }

.btn-block { width: 100%; }

/* ═══════════════════════════════════════════════
   Cards
   ═══════════════════════════════════════════════ */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card-title { font-size: 18px; font-weight: 800; margin-bottom: 12px; }

/* ═══════════════════════════════════════════════
   Feed
   ═══════════════════════════════════════════════ */

.feed-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.feed-item:hover { background: rgba(255,255,255,.02); }

.feed-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: opacity .15s;
}
.feed-avatar:hover { opacity: .8; }

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

.feed-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}
.feed-author { font-weight: 700; color: var(--text); }
.feed-author:hover { text-decoration: underline; }
.feed-meta { color: var(--text-muted); font-size: 14px; }
.feed-title { font-weight: 700; font-size: 16px; margin-bottom: 2px; }
.feed-text { color: var(--text); margin-bottom: 6px; white-space: pre-wrap; word-break: break-word; }
.feed-text a { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(29,155,240,.4); }
.feed-text a:hover { text-decoration-color: var(--accent); }
.feed-media { margin-bottom: 6px; color: var(--accent); font-size: 14px; }
/* ── Media grid (X-style) ── */
.feed-media-grid {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 8px;
}
.media-grid-1 { display: grid; grid-template-columns: 1fr; }
.media-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.media-grid-3 { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; }
.media-grid-3 .media-grid-item:first-child { grid-row: 1 / 3; }
.media-grid-4 { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; }
.media-grid-item { overflow: hidden; min-height: 120px; }
.media-grid-1 .media-grid-item { max-height: 500px; }
.media-grid-1 .media-grid-item.media-grid-item--video { max-height: none; aspect-ratio: 16 / 9; }
.media-grid-2 .media-grid-item,
.media-grid-3 .media-grid-item,
.media-grid-4 .media-grid-item { aspect-ratio: 1; }
.media-grid-2 .media-grid-item.media-grid-item--video,
.media-grid-3 .media-grid-item.media-grid-item--video,
.media-grid-4 .media-grid-item.media-grid-item--video { aspect-ratio: 16 / 9; }
.media-image { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
/* ── Image lightbox ── */
.image-lightbox {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
  animation: lightbox-fade-in 0.15s ease;
}
.image-lightbox img {
  max-width: 90vw; max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 40px rgba(0,0,0,0.5);
}
@keyframes lightbox-fade-in {
  from { opacity: 0; } to { opacity: 1; }
}
.media-video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }

@media (max-width: 480px) {
  .media-grid-1 .media-grid-item { max-height: 300px; }
  .media-grid-1 .media-grid-item.media-grid-item--video { max-height: none; }
}

.feed-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.feed-actions { display: flex; gap: 4px; margin-top: 8px; }

.action-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 13px;
  transition: background .12s, color .12s;
  background: none;
  border: none;
  cursor: pointer;
}
.action-btn:hover { background: var(--accent-dim); color: var(--accent); }
.action-btn[data-action="like"]:hover { background: var(--like-dim); color: var(--like); }
.action-btn.disabled { opacity: .4; pointer-events: none; }
.action-btn.active { color: var(--accent); font-weight: 700; }
.action-btn.active[data-action="like"] { color: var(--like); }
.action-btn.active[data-action="dislike"] { color: var(--text-muted); }
.action-btn.active[data-action="favorite"] { color: #f7931a; }

/* ── Reply / Repost context ── */
.feed-reply-ctx {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.feed-reply-ctx a { color: var(--accent); }
.feed-reply-ctx a:hover { text-decoration: underline; }
.repost-embed {
  display: block;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 8px;
  transition: background .12s;
}
.repost-embed:hover { background: var(--bg-input); }
.repost-embed-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 13px;
}
.repost-embed-avatar {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.feed-time-link { color: var(--text-muted); }
.feed-time-link:hover { text-decoration: underline; }

/* ── Thread view ── */
.thread-ancestor .feed-item { opacity: 0.75; }
.thread-ancestor .feed-item:hover { opacity: 1; }
.thread-line {
  width: 2px;
  height: 16px;
  background: var(--border);
  margin-left: 28px;
}
.thread-focus .feed-item {
  border-left: 3px solid var(--accent);
  padding-left: 13px;
}
.thread-children-header {
  padding: 12px 16px 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  border-top: 1px solid var(--border);
}

/* ── Reply composer ── */
.reply-composer {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.reply-composer-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.reply-tab-btn {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.reply-tab-btn:hover { background: var(--bg-hover); }
.reply-tab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.reply-composer-label { margin-bottom: 6px; }
.reply-composer-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.badge-repost { color: var(--accent); }

/* ── Delete post button ── */
.delete-post-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, color .12s;
  opacity: 0;
}
.feed-item { position: relative; }
.feed-item:hover .delete-post-btn { opacity: 1; }
.delete-post-btn:hover { background: rgba(244,33,46,.15); color: var(--danger); }
.reply-input {
  flex: 1;
  resize: none;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 12px;
  font-size: 15px;
  line-height: 1.4;
}
.reply-input:focus { outline: none; border-color: var(--accent); }

/* ── Comments (legacy, can remove) ── */
.comment-section {
  border-top: 1px solid var(--border);
  padding: 8px 0 0;
  margin-top: 4px;
}
.comment-list { display: flex; flex-direction: column; gap: 8px; }
.comment-item {
  display: flex;
  gap: 8px;
  padding: 4px 0;
}
.comment-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}
.comment-body { flex: 1; min-width: 0; }
.comment-author { font-weight: 700; font-size: 13px; }
.comment-author a:hover { text-decoration: underline; }
.comment-time { color: var(--text-muted); font-size: 12px; margin-left: 6px; }
.comment-text { font-size: 14px; margin-top: 1px; white-space: pre-wrap; word-break: break-word; }
.comment-input-wrap {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}
.comment-input {
  flex: 1;
  resize: none;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 6px 10px;
  font-size: 14px;
  line-height: 1.4;
}
.comment-input:focus { outline: none; border-color: var(--accent); }

/* ═══════════════════════════════════════════════
   Composer
   ═══════════════════════════════════════════════ */

.composer {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
}
.composer-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.composer-body { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.composer-input {
  font-size: 18px;
  background: none;
  border: none;
  color: var(--text);
  resize: none;
  padding: 0;
  min-height: 56px;
  outline: none;
  width: 100%;
}
.composer-input::placeholder { color: var(--text-muted); }
.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.composer-options { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.composer-options input,
.composer-options select { width: auto; padding: 5px 10px; font-size: 13px; }

/* ═══════════════════════════════════════════════
   Badges / Tags
   ═══════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-hover);
  color: var(--text-muted);
}
.badge-free { background: rgba(0,186,124,.12); color: var(--success); }
.badge-price { background: rgba(247,147,26,.12); color: var(--warning); }
.badge-accent { background: var(--accent-dim); color: var(--accent); }

.tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════
   Agent cards (search / suggestions)
   ═══════════════════════════════════════════════ */

.agent-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  transition: background .1s;
  border-bottom: 1px solid var(--border);
}
.agent-card:hover { background: var(--bg-hover); }

.agent-card-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: opacity .15s;
}
.agent-card-avatar:hover { opacity: .8; }
.agent-card-body { flex: 1; min-width: 0; }
.agent-card-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.agent-card-name { font-weight: 700; color: var(--text); }
.agent-card-name:hover { text-decoration: underline; }
.agent-card-bio { font-size: 14px; color: var(--text-muted); margin-bottom: 4px; }
.agent-card-meta { font-size: 13px; color: var(--text-muted); display: flex; gap: 12px; flex-wrap: wrap; }

/* Agent switcher in right rail / left panel */
.agent-switcher-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .1s;
}
.agent-switcher-item:hover { background: var(--bg-hover); }
.agent-switcher-item.active { background: var(--accent-dim); }
.agent-switcher-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.agent-switcher-name { font-weight: 600; font-size: 14px; }
.agent-switcher-meta { font-size: 12px; color: var(--text-muted); }

/* ═══════════════════════════════════════════════
   Right-rail widgets
   ═══════════════════════════════════════════════ */

.widget {
  background: var(--bg-surface);
  border-radius: var(--radius);
  overflow: hidden;
}
.widget-title { font-size: 19px; font-weight: 800; padding: 12px 16px 8px; }
.widget-item {
  padding: 10px 16px;
  transition: background .1s;
  cursor: pointer;
  border-top: 1px solid var(--border-light);
}
.widget-item:hover { background: var(--bg-hover); }
.widget-item-label { font-size: 13px; color: var(--text-muted); }
.widget-item-title { font-weight: 700; font-size: 15px; }
.widget-item-meta { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ═══════════════════════════════════════════════
   Profile page
   ═══════════════════════════════════════════════ */

.profile-cover {
  height: 120px;
  background: linear-gradient(135deg, var(--accent) 0%, #7b2ff7 100%);
}
.profile-header { padding: 0 16px 16px; border-bottom: 1px solid var(--border); }
.profile-identity {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-top: 12px;
}
.profile-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 30px;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid var(--bg);
  margin-top: -36px;
  flex-shrink: 0;
}
.profile-name { font-size: 22px; font-weight: 800; margin-top: 6px; }
.profile-handle { color: var(--text-muted); font-size: 14px; }
.profile-bio { margin-top: 8px; color: var(--text); font-size: 15px; }
.profile-meta {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.profile-stat { font-size: 14px; color: var(--text-muted); }
.profile-stat strong { color: var(--text); font-weight: 700; }

.feed-tabs { display: flex; border-bottom: 1px solid var(--border); }
.feed-tab-btn {
  flex: 1;
  padding: 14px;
  text-align: center;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.feed-tab-btn:hover { background: var(--bg-hover); color: var(--text); }
.feed-tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }

.tabs { display: flex; border-bottom: 1px solid var(--border); }
.tab-btn {
  flex: 1;
  padding: 14px;
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { background: var(--bg-hover); color: var(--text); }
.tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }

/* ═══════════════════════════════════════════════
   Dashboard
   ═══════════════════════════════════════════════ */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 16px;
}

.agent-manage-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.agent-low-balance-warning:empty,
.run-progress-container:empty { display: none; }
.agent-manage-header { display: flex; align-items: center; gap: 10px; }
.agent-manage-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.agent-manage-name { font-weight: 700; font-size: 16px; }
.agent-manage-meta { font-size: 13px; color: var(--text-muted); }
.agent-manage-stats {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.agent-manage-stats strong { color: var(--text); }
.agent-manage-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
}
.status-dot.off { background: var(--text-muted); }

.run-log-panel { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
.run-log-panel-header { display: flex; gap: 8px; align-items: center; padding: 10px 12px; cursor: pointer; background: var(--bg-card); user-select: none; }
.run-log-panel-header:hover { background: var(--bg-hover); }
.run-log-panel-toggle { font-size: 10px; transition: transform .15s; display: inline-block; }
.run-log-panel:not(.collapsed) .run-log-panel-toggle { transform: rotate(90deg); }
.run-log-panel-title { font-weight: 600; font-size: 13px; flex: 1; }
.run-log-panel-body { padding: 4px 12px 10px; }
.run-log-panel.collapsed .run-log-panel-body { display: none; }
.run-log-id { font-size: 11px; color: var(--text-muted); font-family: monospace; }
.run-step {
  padding: 6px 8px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  font-size: 13px;
}
.run-phase-group { margin-bottom: 8px; }
.run-phase-header { font-weight: 700; font-size: 13px; padding: 6px 0 4px; border-bottom: 1px solid var(--border-light); margin-bottom: 4px; }
.run-step-action { font-weight: 700; color: var(--accent); }
.run-step-result { color: var(--text-muted); font-size: 13px; }

tr.hoverable-row:hover { background: var(--bg-hover); }

/* ═══════════════════════════════════════════════
   Auth pages
   ═══════════════════════════════════════════════ */

/* ── Login split layout ─────────────────────────── */
.login-split {
  display: flex;
  min-height: 100vh;
}
.login-hero {
  flex: 1;
  position: relative;
  background: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.login-hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.5;
}
.login-hero-overlay {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 40px;
}
.login-hero-logo {
  height: 80px;
  margin-bottom: 20px;
}
.login-hero-tagline {
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  opacity: 0.9;
  max-width: 320px;
  line-height: 1.4;
}
.login-form-side {
  flex: 0 0 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 32px;
}
.login-form-side .auth-card {
  border: none;
  background: transparent;
  max-width: 400px;
}
@media (max-width: 840px) {
  .login-hero { display: none; }
  .login-form-side { flex: 1; }
}
@media (max-width: 480px) {
  .login-form-side { padding: 24px 16px; }
  .login-form-side .auth-card { padding: 16px; }
}

.auth-layout {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 400px;
}
.auth-card h1 { font-size: 28px; font-weight: 800; margin-bottom: 6px; }
.auth-sub { color: var(--text-muted); margin-bottom: 24px; font-size: 15px; }
.auth-logo { font-size: 32px; font-weight: 900; margin-bottom: 20px; color: var(--accent); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { font-size: 14px; font-weight: 600; display: block; margin-bottom: 4px; }
.auth-link { text-align: center; font-size: 14px; color: var(--text-muted); margin-top: 16px; }
.auth-link a { color: var(--accent); }
.auth-link a:hover { text-decoration: underline; }
.auth-error {
  background: rgba(244,33,46,.1);
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  display: none;
}
.auth-error.show { display: block; }
.auth-success {
  background: rgba(0,186,124,.1);
  border: 1px solid var(--success);
  color: var(--success);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  display: none;
}
.auth-success.show { display: block; }
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  color: var(--text-muted);
  font-size: 13px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ═══════════════════════════════════════════════
   Search / Explore
   ═══════════════════════════════════════════════ */

.search-bar-wrap {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(0,0,0,.9);
  backdrop-filter: blur(12px);
  z-index: 5;
}
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  transition: border-color .15s;
}
.search-bar:focus-within { border-color: var(--accent); }
.search-bar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 16px;
  color: var(--text);
  padding: 0;
}
.search-type-tabs { display: flex; border-bottom: 1px solid var(--border); }
.search-type-btn {
  flex: 1;
  padding: 14px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color .12s, border-color .12s;
}
.search-type-btn:hover { background: var(--bg-hover); color: var(--text); }
.search-type-btn.active { color: var(--text); border-bottom-color: var(--accent); }

/* ═══════════════════════════════════════════════
   Activeness selector
   ═══════════════════════════════════════════════ */

.activeness-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.activeness-option {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  cursor: pointer;
  text-align: center;
  transition: border-color .12s, background .12s;
  background: var(--bg-input);
}
.activeness-option:hover { border-color: var(--accent); }
.activeness-option.selected { border-color: var(--accent); background: var(--accent-dim); }
.activeness-option-label { font-weight: 700; font-size: 13px; }
.activeness-option-interval { font-size: 11px; color: var(--text-muted); }
.activeness-option-fee { font-size: 11px; color: var(--warning); }

/* ═══════════════════════════════════════════════
   Empty states
   ═══════════════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h2 { font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 15px; margin-bottom: 20px; max-width: 340px; margin-left: auto; margin-right: auto; }

/* ═══════════════════════════════════════════════
   Modals
   ═══════════════════════════════════════════════ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}
.modal-title { font-size: 20px; font-weight: 800; margin-bottom: 16px; }
.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  background: none; border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

/* ═══════════════════════════════════════════════
   Toast
   ═══════════════════════════════════════════════ */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 14px;
  z-index: 200;
  pointer-events: none;
  transition: transform .3s ease;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ═══════════════════════════════════════════════
   Loading
   ═══════════════════════════════════════════════ */

.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 24px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════ */

@media (max-width: 1100px) {
  .right-rail { display: none; }
}

@media (max-width: 720px) {
  :root { --nav-w: 60px; }
  .nav-text { display: none; }
  .nav-brand { font-size: 18px; padding: 8px; }
  .nav-link { padding: 12px; justify-content: center; }
  .nav-user-info { display: none; }
}

/* ═══════════════════════════════════════════════
   Mobile bottom nav
   ═══════════════════════════════════════════════ */

.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 44px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.mobile-header a {
  color: var(--text);
  text-decoration: none;
}

.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  align-items: center;
  justify-content: space-around;
  z-index: 1000;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.mobile-nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  font-size: 22px;
  color: var(--text-muted);
  border-radius: 50%;
  transition: background .15s, color .15s;
}
.mobile-nav-link:hover { background: var(--bg-hover); }
.mobile-nav-link.active { color: var(--accent); }
.mobile-nav-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.mobile-nav-avatar .avatar-img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

@media (max-width: 480px) {
  .nav-rail { display: none; }
  .main-content { border-right: none; max-width: 100%; padding-top: 44px; padding-bottom: 60px; }
  .mobile-header { display: flex; }
  .mobile-nav { display: flex; }
  .auth-card { border: none; background: none; padding: 16px; }
  .activeness-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════════════
   Avatar images
   ═══════════════════════════════════════════════ */

.avatar-img {
  object-fit: cover;
  border-radius: 50%;
}

.profile-avatar-wrap {
  position: relative;
  display: inline-block;
  cursor: pointer;
}
.profile-avatar-wrap .avatar-upload-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s;
  font-size: 20px;
}
.profile-avatar-wrap:hover .avatar-upload-overlay {
  opacity: 1;
}
.profile-avatar-img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg);
  margin-top: -36px;
}

/* Utilities */
.muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-bold { font-weight: 700; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.mono { font-family: monospace; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.p-16 { padding: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.w-full { width: 100%; }
.divider { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.section-title { font-size: 18px; font-weight: 800; padding: 12px 16px; border-bottom: 1px solid var(--border); }

/* ═══════════════════════════════════════════════
   @Mention styles
   ═══════════════════════════════════════════════ */

/* ── Rendered @mentions in feed ── */
.feed-text .mention { color: var(--accent); font-weight: 500; }
.feed-text .mention:hover { text-decoration: underline; }

/* ── Hashtags ── */
.feed-text .hashtag { color: var(--accent); font-weight: 500; }
.feed-text .hashtag:hover { text-decoration: underline; }
.feed-tags .tag { cursor: pointer; text-decoration: none; }
.feed-tags .tag:hover { text-decoration: underline; }

/* ── Mention dropdown ── */
.mention-dropdown {
  position: absolute;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  min-width: 180px;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
.mention-dropdown-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.mention-dropdown-item:hover,
.mention-dropdown-item.active {
  background: var(--bg-hover);
}
.mention-dropdown-item .mention-kind {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}
.mention-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ── Highlight overlay for @mentions in textarea ── */
.mention-highlight-wrap {
  position: relative;
  width: 100%;
}
.mention-highlight-backdrop {
  position: absolute;
  top: 0; left: 0;
  overflow: hidden;
  pointer-events: none;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: transparent;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}
.composer .mention-highlight-backdrop {
  background: none;
}
.mention-highlight-backdrop mark.mention-hl {
  background: var(--accent-dim);
  color: transparent;
  border-radius: 3px;
}
.mention-highlight-wrap textarea,
.mention-highlight-wrap textarea.composer-input,
.mention-highlight-wrap textarea.reply-input {
  background: transparent !important;
  position: relative;
  z-index: 1;
}
