/* 账本直嵌：在 social 首页 内复用站点首页 的六页签 UI */

/* 根目录 style.css 在社区样式之后加载，这里把账本主题统一为品牌蓝 */
:root {
  --bg: #f5f7fb;
  --bg-2: #eef4ff;
  --card: #ffffff;
  --ink: #17233d;
  --ink-2: #4e5969;
  --muted: #86909c;
  --line: #e5eaf2;
  --brand: #1677ff;
  --brand-2: #0958d9;
  --brand-3: #69a9ff;
  --down: #00a870;
  --shadow: 0 8px 24px -24px rgba(22, 119, 255, .32);
}
body {
  background: var(--bg);
  color: var(--ink);
}
::selection { background: rgba(22, 119, 255, .18); }
.icon-btn:hover { color: var(--brand); border-color: #bcd7ff; }
.index-item:hover { background: #f3f7ff; }

/* 账本内部硬编码的绿色强调统一替换为品牌蓝 */
.hero {
  background: linear-gradient(135deg, #0b3d91, #1677ff 58%, #5aa8ff);
  box-shadow: 0 18px 36px -30px rgba(22, 119, 255, .55);
}
.hero-label .dot { background: #bcd7ff; box-shadow: 0 0 0 4px rgba(105, 169, 255, .2); }
.btn-ghost:hover, .chip:hover, .modal-close:hover { border-color: #bcd7ff; }
.text-link, .sector-leader { border-bottom-color: rgba(22, 119, 255, .3); }
.loading::before { border-color: rgba(22, 119, 255, .2); }
.stock-watch-row .tag, .stock-result .tag { background: rgba(22, 119, 255, .08); }
.search-row input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: rgba(22, 119, 255, .45);
  box-shadow: 0 0 0 3px rgba(22, 119, 255, .08);
}
.detail-holding { background: rgba(22, 119, 255, .06); border-color: rgba(22, 119, 255, .12); }
.estimate-banner.live {
  background: linear-gradient(120deg, rgba(22, 119, 255, .09), rgba(201, 163, 92, .12));
  border-color: rgba(22, 119, 255, .18);
}
.stock-row:hover td { background: rgba(22, 119, 255, .045); }
.stock-row:focus-visible { outline: 2px solid rgba(22, 119, 255, .45); }
.kline-btn { border-color: rgba(22, 119, 255, .24); }
.bn-item.active { background: rgba(22, 119, 255, .07); }

.social-page-ledger { max-width: 1280px; }
.social-page-ledger .module-panel { margin-top: 0; }
.ledger-embed { min-width: 0; }
.ledger-embed .app-shell { max-width: 1180px; margin: 0 auto; padding: 0 0 28px; }
.ledger-embed .topbar { padding: 0 0 12px; }
.ledger-embed .topbar .brand { display: none; }
.ledger-embed .topbar-right { width: 100%; justify-content: flex-end; }
.ledger-embed .main { padding-bottom: 0; }
.ledger-embed .footer { display: none; }
.ledger-embed .modal-root { z-index: 1100; }

/* 社区顶栏在根目录 style.css 之后加载，这里用更高优先级恢复社区样式 */
.topbar.social-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px clamp(16px, 4vw, 40px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 30px -26px rgba(21, 38, 63, 0.45);
}
.topbar.social-topbar .topbar-market { min-height: 38px; }
.topbar.social-topbar .top-user-btn { border-radius: 999px; }
.topbar.social-topbar .top-user-name {
  max-width: 118px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
}
.topbar.social-topbar .topbar-tools .date-chip {
  padding: 4px 9px;
  font-size: 11px;
  background: #f7f9fd;
}

/* 账本顶栏控件已并入社区顶栏，隐藏重复的 topbar 与大盘条 */
.ledger-embed.topbar-merged .topbar,
.ledger-embed.topbar-merged .index-strip { display: none; }
.topbar.social-topbar .brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.topbar.social-topbar .brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(135deg, var(--brand-2), var(--brand) 62%, var(--brand-3)); color: #fff; box-shadow: 0 8px 20px -10px rgba(22, 119, 255, .65); }
.topbar.social-topbar .brand-text strong { font-size: 15px; letter-spacing: 0.2px; }
.topbar.social-topbar .brand-text small { font-size: 11px; color: var(--muted); letter-spacing: normal; margin-top: 0; }
.topbar.social-topbar .icon-btn { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); }
.topbar.social-topbar .icon-btn:hover { border-color: var(--green); color: var(--green-dark); transform: none; }

/* 根目录 style.css 的 .avatar 会覆盖社区头像，这里恢复社区圆形头像 */
.topbar.social-topbar .avatar,
.view-user-item .avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 800;
  font-size: 15px;
  box-shadow: none;
}
.topbar.social-topbar .avatar.avatar-sm { width: 28px; height: 28px; font-size: 12px; }
.topbar.social-topbar .avatar img,
.view-user-item .avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }

/* 搜索用户弹窗内的头像不受账本全局 .avatar 尺寸影响 */
.view-user-item .avatar.avatar-sm { width: 28px; height: 28px; border-radius: 50%; font-size: 12px; }

/* 只读查看其他用户：写入控件不可交互，服务端还会再次校验 */
body.yjb-readonly #quick-add,
body.yjb-readonly #refresh-btn,
body.yjb-readonly #watch-add-btn,
body.yjb-readonly #holding-add-btn,
body.yjb-readonly #txn-add-btn,
body.yjb-readonly #plan-add-btn,
body.yjb-readonly #refresh-all-btn,
body.yjb-readonly #demo-btn,
body.yjb-readonly #reset-btn,
body.yjb-readonly label.file-btn,
body.yjb-readonly [data-action="txn-add"],
body.yjb-readonly [data-action="holding-add"],
body.yjb-readonly [data-action="watch-add"],
body.yjb-readonly [data-action="plan-add"],
body.yjb-readonly [data-watch-add],
body.yjb-readonly [data-watch-remove],
body.yjb-readonly [data-holding-del],
body.yjb-readonly [data-txn-del],
body.yjb-readonly [data-plan-del],
body.yjb-readonly [data-plan-done] {
  opacity: 0.42 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  filter: grayscale(1);
}

@media (max-width: 1180px) {
  .topbar.social-topbar .topbar-tools .date-chip { display: none; }
  .topbar.social-topbar .topbar-market .mk-item:nth-child(n+6) { display: none; }
}

@media (max-width: 960px) {
  .topbar.social-topbar { flex-wrap: wrap; row-gap: 8px; padding-bottom: 8px; }
  .topbar.social-topbar .topbar-market {
    order: 3;
    flex: 1 0 100%;
    justify-content: flex-start;
    padding: 2px;
  }
  .topbar.social-topbar .topbar-market .mk-item { padding: 4px 8px; }
  .topbar.social-topbar .top-actions { margin-left: auto; }
}

@media (max-width: 800px) {
  .social-page-ledger { padding-left: 12px; padding-right: 12px; }
  .ledger-embed .app-shell { padding-bottom: 104px; }
  .ledger-embed .date-chip { display: none; }
  .ledger-embed .topbar { gap: 8px; }
  .ledger-embed .topbar-right { gap: 6px; }
}

@media (max-width: 640px) {
  .topbar.social-topbar { padding: 10px 14px; gap: 10px; }
  /* 窄屏只保留品牌图标，给右侧操作留出一行所需空间 */
  .topbar.social-topbar .brand { gap: 0; }
  .topbar.social-topbar .brand-text { display: none; }
  .topbar.social-topbar .top-user-name { max-width: 72px; }
  .topbar.social-topbar .topbar-market .mk-item:nth-child(n+5) { display: none; }
  .topbar.social-topbar .topbar-tools #quick-add { display: none; }
  .topbar.social-topbar .topbar-hide-sm { display: none; }
  .topbar.social-topbar .top-actions { gap: 4px; }
  .topbar.social-topbar .top-user-badge { display: none; }
}

/* 平板 / 手机：账本顶栏控件与登录按钮统一高度，避免高低错落 */
@media (max-width: 960px) {
  .topbar.social-topbar .top-actions .btn:not(.readonly-back-btn) {
    height: 34px;
    padding: 0 12px;
    border-radius: 9px;
    font-size: 12.5px;
    line-height: 1;
  }
  .topbar.social-topbar .top-user {
    height: 34px;
    padding: 2px 8px 2px 3px !important;
  }
}
