/* =========================================================================
   Design System — LinkedIn/Professional
   ========================================================================= */
:root {
  --brand: #0a66c2;
  --brand-hover: #004182;
  --brand-bg: rgba(10, 102, 194, 0.08);
  --bg: #f3f2ef;
  --surface: #ffffff;
  --border: #e0dfdc;
  --border-strong: #b0b0b0;
  --ink: rgba(0, 0, 0, 0.9);
  --ink-secondary: #666666;
  --ink-tertiary: #999999;
  --like-color: #0a66c2;
  --like-bg: rgba(10, 102, 194, 0.08);
  --evidence-color: #057642;
  --shadow-card: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 0 0 1px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
  --radius-card: 8px;
  --radius-full: 9999px;
  --topnav-height: 52px;
  --left-col: 225px;
  --feed-col: 552px;
  --right-col: 300px;
}

/* =========================================================================
   Base Reset
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}
button { font: inherit; cursor: pointer; border: none; background: none; }
h1, h2, h3, h4, p, pre { margin: 0; }
a { text-decoration: none; color: inherit; }

/* =========================================================================
   Buttons
   ========================================================================= */
.btn-primary {
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius-full);
  padding: 8px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  transition: background 150ms, opacity 150ms;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }

.btn-secondary {
  background: transparent;
  color: var(--brand);
  border: 1.5px solid var(--brand);
  border-radius: var(--radius-full);
  padding: 7px 18px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: background 150ms;
  white-space: nowrap;
}
.btn-secondary:hover { background: var(--brand-bg); }
.btn-secondary:disabled { opacity: 0.6; cursor: wait; }

.btn-lang {
  background: transparent;
  color: var(--ink-secondary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: background 150ms;
}
.btn-lang:hover { background: var(--bg); }

/* =========================================================================
   Top Navigation Bar
   ========================================================================= */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topnav-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
}

.topnav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
  white-space: nowrap;
}

.topnav-logo-icon {
  width: 34px;
  height: 34px;
  background: var(--brand);
  border-radius: 4px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  flex-shrink: 0;
}

.topnav-spacer { flex: 1; }

.topnav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* =========================================================================
   Page Shell + 3-Column Grid
   ========================================================================= */
.page-shell {
  background: var(--bg);
  min-height: 100vh;
}

.content-grid {
  display: grid;
  grid-template-columns: var(--left-col) var(--feed-col) var(--right-col);
  gap: 24px;
  max-width: calc(var(--left-col) + var(--feed-col) + var(--right-col) + 72px);
  margin: 24px auto 40px;
  padding: 0 24px;
  align-items: start;
}

/* =========================================================================
   Left Panel — Profile / Stats Card
   ========================================================================= */
.left-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  text-align: center;
}

.profile-card-banner {
  height: 56px;
  background: linear-gradient(135deg, var(--brand) 0%, #0073b1 100%);
}

.profile-card-body {
  padding: 0 16px 16px;
}

.profile-card-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  font-weight: 700;
  border: 3px solid var(--surface);
  margin: -28px auto 8px;
}

.profile-card-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
}

.profile-card-sub {
  font-size: 0.78rem;
  color: var(--ink-secondary);
  margin-bottom: 12px;
  line-height: 1.4;
}

.profile-card-stats {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  display: grid;
  gap: 6px;
}

.profile-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
}
.profile-stat-row span:first-child { color: var(--ink-secondary); }
.profile-stat-row strong { color: var(--brand); font-weight: 700; }

/* Visibility / runtime info card */
.visibility-info {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 10px 14px;
  font-size: 0.75rem;
  color: var(--ink-secondary);
  line-height: 1.5;
}
.visibility-info strong { color: var(--ink); }

/* =========================================================================
   Center Feed Column
   ========================================================================= */
.feed-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feed-column-header {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.feed-column-header h1 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}
.feed-column-header-meta {
  font-size: 0.78rem;
  color: var(--ink-secondary);
}

/* =========================================================================
   Post Cards — LinkedIn Style
   ========================================================================= */
.post-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 150ms;
}
.post-card:hover { box-shadow: var(--shadow-hover); }
.post-card.is-active {
  box-shadow: 0 0 0 2px var(--brand), 0 4px 12px rgba(0, 0, 0, 0.1);
}

.post-card-body { padding: 16px 16px 0; }

.post-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.post-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.post-author-block {
  flex: 1;
  min-width: 0;
}
.post-author-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}
.post-author-sub {
  font-size: 0.78rem;
  color: var(--ink-secondary);
}
.post-timestamp {
  font-size: 0.75rem;
  color: var(--ink-tertiary);
  white-space: nowrap;
  margin-left: auto;
  padding-top: 2px;
}

.trait-tag {
  display: inline-flex;
  align-items: center;
  background: var(--brand-bg);
  color: var(--brand);
  border-radius: 2px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}

.post-content {
  font-size: 0.9rem;
  color: var(--ink);
  line-height: 1.55;
  margin-bottom: 12px;
}

/* Reaction summary row */
.post-reactions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 0;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--ink-secondary);
}
.reaction-icon { font-size: 0.9rem; }
.post-reactions .round-badge { margin-left: auto; }

/* Action bar */
.post-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border);
}
.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 8px;
  font-size: 0.82rem;
  color: var(--ink-secondary);
  font-weight: 600;
  transition: background 150ms, color 150ms;
}
.action-btn:hover {
  background: var(--bg);
  color: var(--ink);
}
.action-btn.is-liked { color: var(--brand); }
.action-icon { font-size: 1rem; line-height: 1; }

/* =========================================================================
   Right Sidebar
   ========================================================================= */
.sidebar-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.sidebar-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--border);
}

.sidebar-card-subtitle {
  font-size: 0.75rem;
  color: var(--ink-secondary);
  padding: 8px 16px 4px;
}

/* =========================================================================
   Agent "People You May Know" Cards
   ========================================================================= */
.agent-card {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 0 10px;
  align-items: start;
}
.agent-card:last-child { border-bottom: none; }

.agent-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.agent-body { min-width: 0; }
.agent-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}
.agent-sub {
  font-size: 0.75rem;
  color: var(--ink-secondary);
  margin-bottom: 8px;
  line-height: 1.4;
}

.btn-connect {
  background: transparent;
  color: var(--brand);
  border: 1.5px solid var(--brand);
  border-radius: var(--radius-full);
  padding: 4px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 150ms, color 150ms;
}
.btn-connect:hover { background: var(--brand-bg); }
.btn-connect.is-expanded {
  background: var(--brand);
  color: #fff;
}

/* Expanded agent detail */
.agent-detail {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 10px 16px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.agent-detail.is-open { display: flex; }

.agent-reward-note {
  font-size: 0.75rem;
  color: var(--ink-secondary);
  font-style: italic;
}

/* Strategy bars */
.strategy-row { display: grid; gap: 3px; }
.strategy-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--ink-secondary);
}
.strategy-track {
  height: 5px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.strategy-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--brand), #0073b1);
}

/* Reward mini-grid */
.reward-mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 4px;
}
.reward-mini-box {
  background: var(--surface);
  border-radius: 6px;
  padding: 7px 10px;
  border: 1px solid var(--border);
}
.reward-mini-box strong {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
}
.reward-mini-box span {
  font-size: 0.7rem;
  color: var(--ink-secondary);
}

/* =========================================================================
   Reward Model Card
   ========================================================================= */
.reward-model-body {
  padding: 10px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.reward-model-note {
  font-size: 0.75rem;
  color: var(--ink-secondary);
  line-height: 1.4;
}
.reward-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.reward-pill {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px 9px;
  font-size: 0.73rem;
  color: var(--ink-secondary);
}

/* Consistency matrix */
.matrix-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
  font-size: 0.63rem;
}
.matrix-cell {
  padding: 3px 1px;
  text-align: center;
  border-radius: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.matrix-cell.is-head {
  background: var(--brand-bg);
  color: var(--brand);
  font-weight: 700;
}
.matrix-note {
  font-size: 0.7rem;
  color: var(--ink-tertiary);
}

/* =========================================================================
   Post Detail Modal
   ========================================================================= */
.detail-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.5);
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 16px;
}
.detail-modal-backdrop.is-open { display: flex; }

.detail-modal {
  background: var(--surface);
  border-radius: var(--radius-card);
  width: min(680px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
}

.detail-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.detail-modal-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}
.btn-close-modal {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1rem;
  color: var(--ink-secondary);
  transition: background 150ms;
}
.btn-close-modal:hover { background: var(--bg); }

.detail-modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Thread-style post inside modal */
.detail-post-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.detail-post-author-block { flex: 1; min-width: 0; }
.detail-post-author-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}
.detail-post-author-sub {
  font-size: 0.8rem;
  color: var(--ink-secondary);
}
.detail-post-content {
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.6;
  margin-top: 12px;
}
.detail-post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-top: 12px;
}

/* Sections inside modal */
.detail-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.detail-section h4 {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.evidence-item {
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
  display: grid;
  gap: 5px;
}
.evidence-item-meta {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.evidence-item p {
  font-size: 0.83rem;
  color: var(--ink);
  line-height: 1.45;
}
.prompt-box {
  background: var(--bg);
  border: 1px dashed var(--border-strong);
  border-radius: 6px;
  padding: 12px;
  font-size: 0.75rem;
  color: var(--ink-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  font-family: "SF Mono", "Consolas", "Menlo", monospace;
}

/* =========================================================================
   Shared Micro-components
   ========================================================================= */
.meta-pill {
  display: inline-flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 2px 9px;
  font-size: 0.72rem;
  color: var(--ink-secondary);
}
.round-badge {
  display: inline-flex;
  align-items: center;
  background: var(--brand-bg);
  color: var(--brand);
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 700;
}

.empty-state {
  padding: 36px 16px;
  text-align: center;
  color: var(--ink-secondary);
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.empty-state h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}
.empty-state p {
  font-size: 0.83rem;
  line-height: 1.5;
  max-width: 300px;
  margin: 0 auto;
}

/* =========================================================================
   Responsive
   ========================================================================= */

/* Tablet: hide left panel */
@media (max-width: 1100px) {
  .content-grid {
    grid-template-columns: 1fr var(--right-col);
    max-width: 100%;
  }
  .left-panel { display: none; }
}

/* Narrow tablet: shrink right sidebar */
@media (max-width: 900px) {
  .content-grid { grid-template-columns: 1fr 260px; }
}

/* Mobile: single column */
@media (max-width: 700px) {
  .content-grid {
    grid-template-columns: 1fr;
    padding: 0 12px;
    gap: 12px;
    margin-top: 16px;
  }
  .sidebar-column { display: none; }
  .topnav-logo > span { display: none; }
  .topnav { padding: 0 16px; gap: 8px; }
  .btn-primary, .btn-secondary { padding: 7px 14px; font-size: 0.8rem; }
}
