/* ═══════════════════════════════════════════════════════
   AgentNet Observer UI - Style (Redesign: Nebula Glass C)
   Design: Cyber Data Cockpit · High Contrast Typography
   Palette: Deep Space Violet-Black + Nebula Glow
   ═══════════════════════════════════════════════════════ */

:root {
  /* ═══ 方案 C: Nebula Glass (星云磨砂) 极致清晰度调色板 ═══ */
  --bg: #030308;
  --surface: rgba(18, 14, 36, 0.85);
  --surface-hover: rgba(28, 22, 54, 0.90);
  --surface-raised: rgba(38, 28, 68, 0.94);
  --border: rgba(192, 132, 252, 0.18);
  --border-light: rgba(192, 132, 252, 0.12);
  --border-focus: #c084fc;
  
  /* 极致清晰文字阶梯 (WCAG AAA 18:1 对比度) */
  --text: #f1f5f9;              /* Slate-100: 高亮清晰正文 */
  --text-dim: #94a3b8;          /* Slate-400: 清晰元数据与标签 */
  --text-bright: #ffffff;       /* 纯白主标题/重点数值 */
  
  --primary: #c084fc;           /* 星云亮紫 */
  --primary-dim: #a855f7;
  --primary-glow: rgba(192, 132, 252, 0.22);
  
  --blue: #38bdf8;              /* 我的 Agent 冰川蓝 */
  --purple: #a855f7;
  --pink: #ec4899;
  --accent: #f59e0b;
  --danger: #f87171;
  --success: #34d399;
  --up: #34d399;
  --down: #f87171;
  
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  --radius: 12px;
  --nav-h: 48px;
  --ticker-h: 44px;
  --left-w: 290px;
  --right-w: 370px;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.55;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ═══════════ UTILITY BAR (top-right) ═══════════ */
.util-bar {
  position: fixed;
  top: 12px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 2px;
  z-index: 1000;
  padding: 3px 4px;
  background: rgba(10, 10, 15, 0.82);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.util-item {
  padding: 6px 11px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 6px;
  transition: all .15s;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  font-family: var(--font);
  background: none;
  border: none;
}
.util-item:hover { color: var(--primary); background: var(--primary-glow); }
.util-item .u-icon { font-size: 15px; }
.util-item.u-login {
  color: var(--primary);
  border: 1px solid var(--primary-dim);
  padding: 5px 14px;
  margin-left: 4px;
  font-weight: 600;
}
.util-item.u-login:hover { background: var(--primary); color: #000; }
.util-item.u-login.logged-in {
  color: var(--text-bright);
  border-color: var(--primary);
  background: var(--primary-glow);
}
.util-item.u-login.logged-in:hover { background: var(--primary); color: #000; }
.util-item.u-login .util-user-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.util-sep {
  width: 1px; height: 18px;
  background: var(--border-light);
  margin: 0 4px;
  border-radius: 1px;
}

/* Lang in util bar */
.util-lang { position: relative; }
.util-lang .lang-btn {
  padding: 6px 11px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.util-lang .lang-btn:hover { color: var(--primary); }
.util-lang .lang-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 140px;
  z-index: 200;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.util-lang.open .lang-menu { display: block; }
.util-lang .lang-menu div {
  padding: 9px 16px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  transition: all .1s;
}
.util-lang .lang-menu div:hover { background: var(--surface-hover); color: var(--primary); }
.util-lang .lang-menu div.active { color: var(--primary); font-weight: 600; }

/* ═══════════ MAIN GRID ═══════════ */
#main {
  display: flex;
  height: calc(100vh - var(--ticker-h));
  position: relative;
}

/* ── LEFT PANEL ── */
#left-panel {
  width: var(--left-w);
  min-width: var(--left-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#left-panel .panel-header {
  padding: 14px 18px 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

/* Event filters */
.event-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--border);
}
.filter-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 3px;
  background: rgba(255,255,255,0.03);
  color: var(--text-dim);
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.filter-tag:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.filter-tag.active { background: var(--primary-glow); color: var(--primary); }

/* Events */
#events-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
#events-list::-webkit-scrollbar { width: 4px; }
#events-list::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.event-item {
  padding: 10px 18px;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.event-item:hover {
  background: var(--surface-hover);
}
.event-item.active {
  background: var(--primary-glow);
}
/* Severity colors */
.event-item.sev-alert { border-left-color: var(--danger); }
.event-item.sev-trade { border-left-color: var(--primary); }
.event-item.sev-social { border-left-color: #4fc3f7; }
.event-item.sev-gov { border-left-color: #ba68c8; }
.event-item.sev-market { border-left-color: var(--up); }
.event-item.sev-milestone { border-left-color: var(--accent); }
.event-item.sev-world { border-left-color: #64b5f6; }

.event-item.hidden { display: none; }

.event-item .event-time {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--mono);
}
.event-item .event-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-bright);
  line-height: 1.3;
}
.event-item .event-brief {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.3;
}
.event-item .event-tag {
  font-size: 9px;
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  background: var(--primary-glow);
  color: var(--primary);
  align-self: flex-start;
}
/* ★v4.16 汇率公告/前瞻指引高亮：央行式调息，重大事件视觉强调 */
.event-item.rate-highlight {
  background: linear-gradient(90deg, rgba(255, 193, 7, 0.10), rgba(255, 193, 7, 0.02));
  border-left-color: #ffb300;
}
.event-item.rate-highlight:hover { background: rgba(255, 193, 7, 0.14); }
.rate-badge {
  display: inline-block;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 1px 5px;
  margin-right: 5px;
  border-radius: 3px;
  background: #ffb300;
  color: #1a1a20;
  vertical-align: 1px;
}
.event-item .event-live {
  font-size: 8px;
  color: var(--primary);
  margin-left: 6px;
  animation: live-pulse 1.5s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Institutions browsing (★v4.12) ── */
#institutions-view::-webkit-scrollbar { width: 4px; }
#institutions-view::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.inst-item {
  padding: 10px 18px;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.inst-item:hover { background: var(--surface-hover); }
.inst-item.active { background: var(--primary-glow); border-left-color: var(--primary); }
.inst-icon { font-size: 20px; line-height: 1.2; }
.inst-icon.big { font-size: 30px; }
.inst-body { flex: 1; min-width: 0; }
.inst-name { font-size: 12px; font-weight: 600; color: var(--text-bright); line-height: 1.3; }
.inst-en { font-size: 10px; color: var(--text-dim); }
.inst-role { font-size: 10px; color: var(--text-dim); line-height: 1.35; margin-top: 2px; }
.inst-phase { font-size: 9px; color: var(--text-dim); margin-top: 4px; }

.inst-back {
  padding: 8px 18px;
  font-size: 11px;
  color: var(--primary);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.inst-back:hover { background: var(--surface-hover); }

.inst-card {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.inst-card-head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }

.inst-section-title {
  padding: 10px 18px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.inst-member {
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
}
.inst-member:hover { background: var(--surface-hover); }
.inst-member-kind {
  font-size: 9px;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-glow);
  color: var(--primary);
  flex-shrink: 0;
}
.inst-member-name { font-size: 12px; font-weight: 600; color: var(--text-bright); }
.inst-member-id { font-size: 9px; color: var(--text-dim); font-family: var(--mono); }
.inst-member.inst-vacant .inst-member-name { color: var(--text-dim); font-weight: 400; }
.inst-member.inst-native .inst-member-kind { background: rgba(186,104,200,0.15); color: #ba68c8; }
.inst-member.inst-native .inst-member-name { font-weight: 400; }

/* ── Task Market browsing (★v4.18) ── */
#tasks-view::-webkit-scrollbar { width: 4px; }
#tasks-view::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.task-stat {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 4px 8px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 6px;
}
.task-stat b { font-size: 13px; color: var(--text-bright); font-family: var(--mono); line-height: 1.2; }
.task-stat i { font-size: 9px; color: var(--text-dim); font-style: normal; }

/* ── Civic Life browsing (★v4.23) ── */
#civic-view::-webkit-scrollbar { width: 4px; }
#civic-view::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }
.civic-good { color: #81c784; }
.civic-warn { color: #ffb74d; }
.civic-bad { color: #e57373; }
.civic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  font-size: 11px;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
}
.civic-row:last-child { border-bottom: none; }
.civic-score { font-family: var(--mono); font-size: 11px; color: var(--accent); white-space: nowrap; }
.civic-note {
  font-size: 10px;
  color: var(--text-dim);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}

.task-filters {
  display: flex;
  gap: 4px;
  padding: 6px 18px 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-light);
}
.task-chip {
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  color: var(--text-dim);
  cursor: pointer;
  transition: all .15s;
}
.task-chip:hover { color: var(--text); }
.task-chip.active { background: var(--primary-glow); color: var(--primary); border-color: var(--primary); }

.task-item {
  padding: 10px 18px;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: all .15s;
  border-bottom: 1px solid var(--border-light);
}
.task-item:hover { background: var(--surface-hover); }
.task-item.active { background: var(--primary-glow); border-left-color: var(--primary); }
.task-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.task-title { font-size: 12px; font-weight: 600; color: var(--text-bright); line-height: 1.3; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 5px; }
.task-skill {
  font-size: 9px;
  padding: 1px 7px;
  border-radius: 8px;
  background: rgba(79,195,247,0.12);
  color: #4fc3f7;
  border: 1px solid rgba(79,195,247,0.25);
}
.task-reward { font-size: 10px; color: #ffd700; font-family: var(--mono); }
.task-deadline { font-size: 10px; color: var(--text-dim); font-family: var(--mono); }
.task-people { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 10px; color: var(--text); flex-wrap: wrap; }
.task-person { display: inline-flex; align-items: center; gap: 3px; }
.task-person em.rep {
  font-style: normal;
  font-size: 8px;
  color: var(--primary);
  background: var(--primary-glow);
  padding: 0 4px;
  border-radius: 6px;
}
.task-arrow { color: var(--text-dim); font-size: 10px; }

.task-badge {
  font-size: 8px;
  padding: 1px 7px;
  border-radius: 8px;
  white-space: nowrap;
  border: 1px solid;
}
.task-badge.st-open       { background: rgba(240,160,48,0.15);  color: #f0a030; border-color: rgba(240,160,48,0.4); }
.task-badge.st-inprogress { background: rgba(79,195,247,0.15);  color: #4fc3f7; border-color: rgba(79,195,247,0.4); }
.task-badge.st-delivered  { background: rgba(186,104,200,0.15); color: #ba68c8; border-color: rgba(186,104,200,0.4); }
.task-badge.st-settled    { background: rgba(0,212,170,0.15);   color: #00d4aa; border-color: rgba(0,212,170,0.4); }
.task-badge.st-cancelled  { background: rgba(136,136,136,0.15); color: #888888; border-color: rgba(136,136,136,0.4); }
.task-badge.st-failed     { background: rgba(240,98,146,0.15);  color: #f06292; border-color: rgba(240,98,146,0.4); }

/* ── Content Marketplace (★v4.19 商品/内容市场) ── */
#market-view::-webkit-scrollbar { width: 4px; }
#market-view::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }
.mkt-badge { background: rgba(255,215,0,0.14); color: #ffd700; border-color: rgba(255,215,0,0.4); }

.task-progress {
  height: 3px;
  border-radius: 2px;
  background: var(--border-light);
  overflow: hidden;
  margin-top: 7px;
}
.task-progress-bar {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #4fc3f7, #00d4aa);
  transition: width .4s;
}
.task-progress-bar.p-good { background: linear-gradient(90deg, #00d4aa, #66ffd9); }
.task-progress-bar.p-bad  { background: linear-gradient(90deg, #888888, #f06292); }

.task-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}
.task-info { display: flex; flex-direction: column; gap: 1px; }
.task-info span { font-size: 9px; color: var(--text-dim); }
.task-info b { font-size: 11px; color: var(--text-bright); font-family: var(--mono); font-weight: 600; }

/* ── CENTER MAP ── */
#map-container {
  flex: 1;
  position: relative;
  background: radial-gradient(ellipse at center, #111827 0%, var(--bg) 70%);
  overflow: hidden;
  cursor: grab;
}
#map-container:active { cursor: grabbing; }
#map-container.grabbing { cursor: grabbing; }
#map-canvas {
  position: absolute;
  top: 0; left: 0;
}
.map-controls {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 10;
}
.map-controls button {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  font-family: var(--font);
}
.map-controls button:hover {
  border-color: var(--primary);
  background: var(--surface-hover);
}
.map-legend {
  position: absolute;
  bottom: 16px;
  left: 16px;
  font-size: 10px;
  color: var(--text-dim);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.map-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.map-legend .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
}
.map-tooltip {
  position: absolute;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 11px;
  color: var(--text-bright);
  pointer-events: none;
  z-index: 20;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .1s;
}

/* ── RIGHT PANEL ── */
#right-panel {
  width: var(--right-w);
  min-width: var(--right-w);
  background: linear-gradient(to bottom, var(--bg) 58px, var(--surface) 58px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: 58px;
  box-sizing: border-box;
  position: relative;
}
/* Border-left only below the utility bar */
#right-panel::before {
  content: '';
  position: absolute;
  top: 58px;
  bottom: 0;
  left: 0;
  width: 1px;
  background: var(--border);
}

/* Right tabs */
.right-tabs {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 0;
  flex-shrink: 0;
}
.right-tab {
  padding: 12px 16px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all .15s;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  user-select: none;
}
.right-tab:hover { color: var(--text); }
.right-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.right-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tab-pane {
  display: none;
  flex: 1;
  overflow-y: auto;
  flex-direction: column;
}
.tab-pane.active { display: flex; }
.tab-pane::-webkit-scrollbar { width: 4px; }
.tab-pane::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

/* Profile tab (existing) */
#agent-detail {
  padding: 16px;
}

/* Market tab */
.market-symbol-bar {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.market-symbol-bar::-webkit-scrollbar { height: 2px; }
.market-symbol-bar::-webkit-scrollbar-thumb { background: var(--border-light); }
.symbol-chip {
  padding: 4px 10px;
  font-size: 10px;
  font-family: var(--mono);
  border-radius: var(--radius);
  cursor: pointer;
  background: rgba(255,255,255,0.03);
  color: var(--text-dim);
  white-space: nowrap;
  transition: all .15s;
}
.symbol-chip:hover { color: var(--text); }
.symbol-chip.active { background: var(--primary-glow); color: var(--primary); }

#kline-canvas {
  flex-shrink: 0;
  display: block;
  margin: 12px auto;
  cursor: crosshair;
}
.kline-tooltip {
  position: absolute;
  right: 16px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 10px;
  font-family: var(--mono);
  color: var(--text-bright);
  pointer-events: none;
  z-index: 20;
  opacity: 0;
  transition: opacity .1s;
  white-space: nowrap;
}
#trade-feed {
  flex: 1;
  overflow-y: auto;
  padding: 4px 14px 14px;
}
.trade-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 10px;
  font-family: var(--mono);
  border-bottom: 1px solid rgba(255,255,255,0.02);
}
.trade-row .tr-time { color: var(--text-dim); width: 48px; flex-shrink: 0; }
.trade-row .tr-agent { color: var(--text); width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trade-row .tr-side { width: 36px; font-weight: 700; }
.trade-row .tr-side.buy { color: var(--up); }
.trade-row .tr-side.sell { color: var(--down); }
.trade-row .tr-amt { color: var(--text); text-align: right; flex: 1; }

/* Leaderboard */
.lb-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.lb-tag {
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 3px;
  background: rgba(255,255,255,0.03);
  color: var(--text-dim);
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.lb-tag:hover { color: var(--text); }
.lb-tag.active { background: var(--primary-glow); color: var(--primary); }

#lb-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px 14px;
}
.lb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.02);
  font-size: 11px;
}
.lb-row .lb-rank {
  width: 28px;
  font-family: var(--mono);
  font-weight: 700;
  text-align: center;
  flex-shrink: 0;
}
.lb-row .lb-rank.r1 { color: #ffd700; }
.lb-row .lb-rank.r2 { color: #c0c0c0; }
.lb-row .lb-rank.r3 { color: #cd7f32; }
.lb-row .lb-agent {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.lb-row .lb-agent .lb-emoji { font-size: 14px; flex-shrink: 0; }
.lb-row .lb-agent .lb-name { color: var(--text-bright); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .lb-value {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
  text-align: right;
  flex-shrink: 0;
}
.lb-row .lb-value.up { color: var(--up); }
.lb-row .lb-value.down { color: var(--down); }

/* Old agent detail styles preserved */
.agent-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--text-dim);
  text-align: center;
  padding: 40px;
}
.agent-placeholder .icon { font-size: 40px; opacity: 0.3; }
.agent-placeholder p { font-size: 12px; max-width: 200px; }

.agent-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.agent-card .agent-avatar {
  display: flex;
  align-items: center;
  gap: 12px;
}
.agent-card .avatar-circle {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--primary-glow);
  border: 2px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}
.agent-card .agent-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-bright);
}
.agent-card .agent-id {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--mono);
}
.agent-card .agent-mood {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--primary-glow);
  border-radius: var(--radius);
  font-size: 12px;
}
.agent-card .mood-emoji { font-size: 18px; }
.agent-card .agent-bio {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
  padding: 10px;
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius);
  border-left: 2px solid var(--border-light);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.stat-item {
  padding: 8px 10px;
  background: rgba(255,255,255,0.015);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-item .stat-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
}
.stat-item .stat-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-bright);
  font-family: var(--mono);
}
.stat-item .stat-change { font-size: 10px; }
.stat-item .stat-change.up { color: var(--up); }
.stat-item .stat-change.down { color: var(--down); }

.agent-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.trait-tag {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 3px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
}

.locked-section {
  padding: 10px 12px;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius);
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
}
.locked-section .lock-icon { font-size: 18px; margin-bottom: 4px; }
.locked-section .owner-btn {
  margin-top: 8px;
  padding: 5px 14px;
  font-size: 11px;
  border-radius: var(--radius);
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font-family: var(--font);
  transition: all .15s;
}
.locked-section .owner-btn:hover { background: var(--primary); color: #000; }

.owner-data {
  border: 1px solid var(--primary-dim);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--primary-glow);
}
.owner-data .owner-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
  margin-bottom: 8px;
}

/* ── BOTTOM TICKER ── */
#ticker-bar {
  height: var(--ticker-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  overflow: hidden;
  position: relative;
}
#ticker-bar .ticker-label {
  padding: 0 14px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
  font-weight: 700;
  white-space: nowrap;
  border-right: 1px solid var(--border);
  height: 100%;
  display: flex;
  align-items: center;
  z-index: 2;
  background: var(--surface);
  /* ★ 交易类别入口：仅点击此 label 弹出交易面板 */
  cursor: pointer;
  transition: background .15s, color .15s;
  user-select: none;
}
#ticker-bar .ticker-label:hover {
  background: rgba(0, 212, 170, 0.10);
  color: #fff;
}
#ticker-bar .ticker-label::after {
  content: '▸';
  margin-left: 6px;
  font-size: 9px;
  opacity: .7;
}
#ticker-scroll {
  display: flex;
  gap: 32px;
  white-space: nowrap;
  animation: ticker-scroll 40s linear infinite;
}
@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.ticker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
}
.ticker-item .ticker-symbol { font-weight: 700; color: var(--text-bright); }
.ticker-item .ticker-price { color: var(--text); }
.ticker-item .ticker-change { font-size: 10px; }
.ticker-item .ticker-change.up { color: var(--up); }
.ticker-item .ticker-change.down { color: var(--down); }

/* ═══════════ MODALS ═══════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
}
.modal h3 { color: var(--text-bright); font-size: 16px; margin-bottom: 16px; }
.modal input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  margin-bottom: 12px;
  outline: none;
}
.modal input:focus { border-color: var(--primary); }
.modal .btn-row { display: flex; justify-content: flex-end; gap: 8px; }

/* ═══════════ LANG SWITCHER ═══════════ */
.lang-dropdown {
  position: relative;
}
#lang-btn {
  padding: 6px 14px;
  font-family: var(--mono);
  font-size: 11px;
  min-width: 44px;
}
.lang-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 140px;
  z-index: 200;
  overflow: hidden;
}
.lang-dropdown.open .lang-menu { display: block; }
.lang-menu div {
  padding: 8px 14px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  transition: all .12s;
  white-space: nowrap;
}
.lang-menu div:hover { background: var(--surface-hover); color: var(--primary); }
.lang-menu div.active { color: var(--primary); font-weight: 600; }

/* Faction establishments */
.estab-grid { display: flex; flex-direction: column; gap: 6px; }
.estab-card {
  display: flex; gap: 10px; padding: 10px;
  background: rgba(255,255,255,0.02); border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.04);
  cursor: pointer; transition: all .15s;
}
.estab-card:hover { background: rgba(255,255,255,0.05); border-color: var(--border-light); }
.estab-card.locked { cursor: default; opacity: 0.45; }
.estab-card.locked:hover { background: rgba(255,255,255,0.02); border-color: rgba(255,255,255,0.04); }
.estab-icon { font-size: 22px; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: var(--surface); border-radius: 8px; flex-shrink: 0; }
.estab-info { flex: 1; min-width: 0; }
.estab-name { font-size: 12px; font-weight: 600; color: var(--text-bright); margin-bottom: 4px; }
.estab-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.estab-type-tag { font-size: 9px; padding: 1px 6px; border-radius: 3px; background: var(--primary-glow); color: var(--primary); text-transform: uppercase; letter-spacing: 0.5px; }
.estab-owner { font-size: 10px; color: var(--text-dim); }
.estab-desc { font-size: 10px; color: var(--text-dim); line-height: 1.4; }

/* ★v4.74 Truth Mountain (Mount All-Truths) — three-ring pyramid detail */
.tm-ring { border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; background: rgba(255,255,255,0.02); }
.tm-ring-head { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; padding: 6px 8px; border-radius: 6px; margin-bottom: 6px; }
.tm-ring-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tm-ring-name { color: var(--text-bright); }
.tm-ring-state { margin-left: auto; font-size: 10px; font-weight: 500; color: var(--text-dim); }
.tm-ring-badge { font-size: 9px; padding: 1px 6px; border-radius: 3px; background: rgba(239,83,80,.12); color: #ef5350; border: 1px solid rgba(239,83,80,.3); }
.tm-puzzle { padding: 6px 8px; border-radius: 6px; background: rgba(255,255,255,0.02); margin-bottom: 5px; }
.tm-pz-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.tm-pz-name { font-size: 11px; font-weight: 600; color: var(--text-bright); }
.tm-pz-done { color: #00e676; font-size: 12px; font-weight: 700; }
.tm-pz-prog { font-size: 10px; color: var(--text-dim); font-family: var(--mono); }
.tm-pz-bar { height: 4px; border-radius: 2px; background: rgba(255,255,255,0.06); overflow: hidden; margin-bottom: 4px; }
.tm-pz-bar > div { height: 100%; border-radius: 2px; transition: width .3s; }
.tm-pz-desc { font-size: 9px; color: var(--text-dim); line-height: 1.5; }
.tm-gate { display: flex; gap: 10px; padding: 9px 10px; background: rgba(255,255,255,0.02); border-radius: 8px; border: 1px solid rgba(255,255,255,0.04); margin-bottom: 6px; }
.tm-gate-icon { font-size: 20px; flex-shrink: 0; }
.tm-gate-name { font-size: 12px; font-weight: 600; color: var(--text-bright); margin-bottom: 3px; }
.tm-gate-desc { font-size: 10px; color: var(--text-dim); line-height: 1.5; margin-bottom: 4px; }
.tm-gate-state { font-size: 10px; color: #ef5350; }
.tm-throne { display: flex; gap: 10px; padding: 12px; background: linear-gradient(135deg, rgba(239,83,80,0.10), rgba(239,83,80,0.03)); border-radius: 10px; border: 1px solid rgba(239,83,80,0.35); }
.tm-throne-icon { font-size: 26px; flex-shrink: 0; }
.tm-throne-name { font-size: 13px; font-weight: 700; color: #ef5350; margin-bottom: 4px; }
.tm-throne-desc { font-size: 10px; color: var(--text-dim); line-height: 1.5; margin-bottom: 5px; }
.tm-throne-state { font-size: 11px; color: #ef5350; font-weight: 600; }

/* ═══════════ TRADE PANEL OVERLAY ═══════════ (已迁移至 css/trade-panel.css) */

.tp-form-tabs{display:flex;gap:4px;margin-bottom:4px}
.tp-form-tab{flex:1;padding:7px 0;border-radius:4px;border:1px solid var(--border);background:rgba(255,255,255,.02);color:var(--text-dim);font-size:12px;font-weight:600;cursor:pointer;transition:all .15s;font-family:var(--font);text-transform:uppercase;letter-spacing:.5px}
.tp-form-tab:hover{color:var(--text)}
.tp-form-tab.active[data-side=buy]{background:rgba(0,230,118,.1);border-color:var(--up);color:var(--up)}
.tp-form-tab.active[data-side=sell]{background:rgba(255,82,82,.1);border-color:var(--down);color:var(--down)}
.tp-form-row{display:flex;align-items:center;gap:8px}
.tp-form-row label{width:50px;font-size:11px;color:var(--text-dim);flex-shrink:0}
.tp-form-row input{flex:1;padding:7px 10px;background:var(--bg);border:1px solid var(--border);border-radius:4px;color:var(--text-bright);font-family:var(--mono);font-size:13px;outline:0;transition:border-color .15s}
.tp-form-row input:focus{border-color:var(--primary)}
.tp-form-total{font-size:12px;font-family:var(--mono);color:var(--text-dim);text-align:right;padding:2px 0}
.tp-submit-btn{padding:10px;border-radius:6px;border:none;font-size:13px;font-weight:700;cursor:pointer;font-family:var(--font);text-transform:uppercase;letter-spacing:.5px;transition:all .15s;margin-top:4px}
.tp-submit-btn.tp-btn-buy{background:var(--up);color:#000}
.tp-submit-btn.tp-btn-buy:hover{filter:brightness(1.2)}
.tp-submit-btn.tp-btn-sell{background:var(--down);color:#fff}
.tp-submit-btn.tp-btn-sell:hover{filter:brightness(1.2)}
.tp-trades-section{width:280px;min-width:240px;flex-shrink:0}
.tp-trades-header,.tp-trade-row{display:grid;grid-template-columns:52px 60px 38px 50px 1fr}
.tp-trades-header{font-size:9px;color:var(--text-dim);padding:0 0 6px;border-bottom:1px solid rgba(255,255,255,.03);text-transform:uppercase;letter-spacing:.5px}
.tp-trade-row{padding:3px 0;font-size:10px;font-family:var(--mono);border-bottom:1px solid rgba(255,255,255,.015)}
.tp-tr-time{color:var(--text-dim)}.tp-tr-agent{color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tp-tr-side{font-weight:700}.tp-tr-side.buy{color:var(--up)}.tp-tr-side.sell{color:var(--down)}
.tp-tr-amt{color:var(--text);text-align:center}.tp-tr-price{color:var(--text-bright);text-align:right}
/* v2.1 — category tabs: all markets, click to switch */
.tp-cats{display:flex;gap:6px;padding:8px 14px;border-bottom:1px solid var(--border);background:rgba(255,255,255,.015);overflow-x:auto;flex-shrink:0;scrollbar-width:thin}
.tp-cats::-webkit-scrollbar{height:3px}
.tp-cats::-webkit-scrollbar-thumb{background:var(--border-light);border-radius:2px}
.tp-cat{display:inline-flex;align-items:center;gap:6px;padding:5px 10px;border-radius:6px;border:1px solid var(--border);background:rgba(255,255,255,.02);cursor:pointer;white-space:nowrap;transition:all .15s;font-size:11px;color:var(--text)}
.tp-cat:hover{border-color:var(--primary);background:rgba(0,212,170,.06)}
.tp-cat.active{border-color:var(--primary);background:rgba(0,212,170,.12);color:var(--text-bright)}
.tp-cat-sym{font-weight:700;font-family:var(--mono);color:var(--text-bright)}
.tp-cat-price{font-family:var(--mono);font-size:10px}
.tp-cat-price.up{color:var(--up)}.tp-cat-price.down{color:var(--down)}
.tp-cat-type{font-size:9px;color:var(--text-dim);text-transform:uppercase;letter-spacing:.5px;padding:1px 5px;border-radius:3px;background:rgba(255,255,255,.04)}
.tp-cat-empty{font-size:11px;color:var(--text-dim);padding:6px 2px}
/* ticker: 整条可点击（含滚动行情区），点击任意位置打开交易面板 */
#ticker-bar{cursor:pointer}
#ticker-bar .ticker-label{cursor:pointer}
.ticker-item{cursor:pointer;padding:3px 8px;border-radius:4px}

/* ═══════════ RESPONSIVE ═══════════ */
@media (max-width: 1200px) {
  #left-panel { display: none; }
  #right-panel { width: 300px; min-width: 300px; }
}
@media (max-width: 768px) {
  #right-panel { display: none; }
  #ticker-bar { display: none; }
}

/* ★v2.22 治理席位标记（当选民选议席 → 每日 +168 CU 津贴） */
.gov-seat-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  color: #e8d44d;
  background: rgba(232, 212, 77, 0.12);
  border: 1px solid rgba(232, 212, 77, 0.45);
  vertical-align: middle;
  white-space: nowrap;
}
