/* ============================================
   FundMaster — 全局壳层（侧栏 / 顶栏 / 主滚动区）
   设计令牌与 11:336 等帧共用；各页面另链 page-*.css
   ============================================ */

/* ---------- CSS 变量：设计令牌（背景、强调色、圆角） ---------- */
:root {
  --bg-app: #0a0e14;
  --bg-sidebar: #121820;
  --bg-elevated: #151a21;
  --bg-card: rgba(21, 26, 33, 0.7);
  --bg-input: #121820;
  --bg-chip: #151a21;
  --bg-sector: #0f141a;
  --border-subtle: rgba(129, 236, 255, 0.1);
  --border-glow: rgba(129, 236, 255, 0.2);
  --text-primary: #f1f3fc;
  --text-muted: #a8abb3;
  --accent-cyan: #81ecff;
  --accent-bright: #00e5ff;
  --accent-green: #00ffa3;
  --accent-red: #ff716c;
  --accent-amber: #ffc563;
  --accent-magenta: #9f0519;
  --breaking-text: #ffa8a3;
  --live-pill-bg: #1b2028;
  --shadow-fab: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 2px;
  --sidebar-w: 256px;
  --font-sans: "Inter", system-ui, sans-serif;
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

/* ---------- 基础重置与可视隐藏（无障碍） ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-primary);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 应用骨架：左侧栏 + 主区域 ---------- */
.app {
  display: flex;
  min-height: 100vh;
  max-width: 1280px;
  margin: 0 auto;
  background: var(--bg-app);
}

/* 左侧导航：固定宽度 256px，背景 #121820 */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  padding: 32px 0 48px;
  background: var(--bg-sidebar);
  border-right: 1px solid rgba(68, 72, 79, 0.15);
  z-index: 20;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px 32px;
}

/* 品牌图标：Figma 导出 PNG */
.sidebar__logo {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar__name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  line-height: 1.4;
  letter-spacing: -0.05em;
  color: var(--accent-bright);
}

.sidebar__tagline {
  margin: 4px 0 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar__nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 24px;
  overflow: auto;
}

/* 导航链接：默认灰色文字 */
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  border-radius: 0;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.43;
  color: #6b7280;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-link:hover {
  color: var(--text-muted);
}

/* 当前页 News：深色底 + 左侧青绿描边 + 亮青色字 */
.nav-link--active {
  background: #1a222c;
  box-shadow: inset 2px 0 0 0 var(--accent-green);
  color: var(--accent-bright);
}

/* 侧栏菜单图标：assets/icons/nav-*.png */
.nav-link__icon {
  display: block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  object-fit: contain;
  filter: grayscale(1) brightness(0.58);
  opacity: 0.72;
  transition: filter 0.15s ease, opacity 0.15s ease;
}

.nav-link:hover .nav-link__icon {
  filter: grayscale(1) brightness(0.78);
  opacity: 0.86;
}

.nav-link--active .nav-link__icon {
  filter: none;
  opacity: 1;
}

.nav-group {
  margin: 0;
}

.nav-group > summary {
  list-style: none;
  cursor: pointer;
}

.nav-group > summary::-webkit-details-marker {
  display: none;
}

.nav-parent {
  justify-content: flex-start;
}

.nav-caret {
  margin-left: auto;
  width: 10px;
  height: 10px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  opacity: 0.85;
}

.nav-group[open] .nav-caret {
  transform: rotate(225deg);
}

.nav-submenu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 6px;
}

.nav-sublink {
  margin-left: 32px;
  padding: 8px 12px;
  border-radius: 6px;
  color: #7d8592;
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.35;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-sublink:hover {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
}

.nav-sublink--active {
  color: var(--accent-cyan);
}

.sidebar__footer {
  padding: 0 24px;
}

/* Upgrade 按钮：青蓝渐变按钮条 */
.btn-upgrade {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 0;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 16px;
  line-height: 1.5;
  color: #004d57;
  background: linear-gradient(90deg, #00e3fd, var(--accent-cyan));
}

.btn-upgrade__icon {
  font-size: 12px;
}

/* 主壳层：为固定侧栏留出左边距 */
.main-shell {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ---------- 顶栏 ---------- */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 32px;
  min-height: 72px;
  flex-shrink: 0;
  background: var(--bg-app);
}

/* 搜索框容器：圆角 12px，内边距贴近设计 */
.search-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 384px;
  padding: 8px 16px;
  background: var(--bg-input);
  border-radius: var(--radius-lg);
}

/* 搜索框左侧放大镜：assets/icons/header-search.png */
.search-field__icon-img {
  display: block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  object-fit: contain;
  opacity: 0.9;
}

.search-field__input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
}

.search-field__input::placeholder {
  color: var(--text-muted);
}

.search-results {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  z-index: 80;
  overflow: hidden;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  background: rgba(21, 26, 33, 0.98);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.search-result {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px solid rgba(129, 236, 255, 0.08);
}

.search-result:last-child {
  border-bottom: 0;
}

.search-result:hover {
  background: rgba(129, 236, 255, 0.08);
}

.search-result__code {
  color: var(--accent-cyan);
  font: 700 12px var(--font-mono);
}

.search-result__main {
  min-width: 0;
}

.search-result__main strong,
.search-result__main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result__main strong {
  font-size: 13px;
}

.search-result__main small,
.search-results__empty {
  color: var(--text-muted);
  font-size: 12px;
}

.search-results__empty {
  padding: 12px 14px;
}

.top-bar__actions {
  display: flex;
  align-items: center;
  gap: 24px;
}

.icon-btn {
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
}

/* 顶栏通知 / 帮助：PNG 图标 */
.icon-btn__img {
  display: block;
  width: 18px;
  height: 18px;
  object-fit: contain;
  opacity: 0.85;
}

.icon-btn:hover .icon-btn__img {
  opacity: 1;
}

.avatar-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-lg);
  border: 1px solid #44484f;
  overflow: hidden;
  cursor: pointer;
  background: #20262f;
}

.avatar-btn__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- 主内容滚动区 ---------- */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 32px;
  overflow-y: auto;
}

/* 页面标题行：左右两端对齐 */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.page-head__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(28px, 4vw, 36px);
  line-height: 1.11;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.page-head__sub {
  margin: 4px 0 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-muted);
  max-width: 38rem;
}

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

.section-head__title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  line-height: 1.4;
  color: var(--text-primary);
}

.section-head__title--compact {
  font-size: 18px;
}

.section-head__bolt {
  width: 10px;
  height: 14px;
  background: linear-gradient(180deg, var(--accent-cyan), transparent);
  border-radius: 1px;
}

.section-head__layers {
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent-cyan);
  border-radius: 3px;
  opacity: 0.9;
}

.section-head__calendar {
  width: 18px;
  height: 20px;
  border: 2px solid var(--accent-cyan);
  border-radius: 3px;
  position: relative;
}

.section-head__calendar::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 5px;
  height: 2px;
  background: var(--accent-cyan);
}

.section-head__ai {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: radial-gradient(circle at 30% 30%, var(--accent-cyan), transparent 70%);
  border: 1px solid rgba(129, 236, 255, 0.5);
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 11px;
  line-height: 1.5;
}

.pill--ghost {
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-chip);
  color: var(--text-muted);
}

.pill--ghost:hover {
  color: var(--text-primary);
}

/* 面包屑（Portfolio 子页等） */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.breadcrumb__sep {
  opacity: 0.45;
}

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

.breadcrumb a:hover {
  color: var(--accent-cyan);
}

/* 通用玻璃卡片容器 */
.glass-panel {
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* 右下角 FAB */
.fab {
  position: fixed;
  right: max(24px, calc(50vw - 640px + 24px));
  bottom: 32px;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  background: var(--accent-cyan);
  color: var(--bg-app);
  box-shadow: var(--shadow-fab);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab__plus {
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
}

.fab:hover {
  filter: brightness(1.08);
}

/* ---------- 响应式：窄屏改为单栏，侧栏改为顶部抽屉式简化 ---------- */
@media (max-width: 1100px) {
  .news-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  /* 小屏：侧栏移到顶部，主区域全宽 */
  .app {
    flex-direction: column;
  }

  .sidebar {
    position: relative;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 16px;
    border-right: none;
    border-bottom: 1px solid rgba(68, 72, 79, 0.2);
  }

  .sidebar__nav {
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    padding: 0;
  }

  .nav-group {
    width: 100%;
  }

  .nav-submenu {
    width: 100%;
  }

  .nav-sublink {
    margin-left: 12px;
  }

  .nav-link {
    padding: 8px 12px;
    font-size: 13px;
  }

  .sidebar__footer {
    width: 100%;
    padding: 16px 0 0;
  }

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

  .top-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
  }

  .top-bar__actions {
    justify-content: flex-end;
  }

  .content {
    padding: 16px;
  }

  .fab {
    right: 16px;
    bottom: 16px;
  }
}

/* ---------- Upgrade to Pro modal ---------- */
body.pro-modal-open {
  overflow: hidden;
}

.pro-modal[hidden] {
  display: none;
}

.pro-modal {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: grid;
  place-items: center;
  padding: 24px;
}

.pro-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 14, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.pro-modal__panel {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid rgba(255, 197, 99, 0.28);
  border-radius: 22px;
  background: rgba(21, 26, 33, 0.98);
  color: var(--text-primary);
  padding: 24px;
}

.pro-modal__cancel {
  position: absolute;
  top: 18px;
  right: 18px;
  border: 1px solid rgba(168, 171, 179, 0.3);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font: 700 12px var(--font-sans);
  padding: 7px 12px;
  cursor: pointer;
}

.pro-modal__hero {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid rgba(129, 236, 255, 0.12);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(129, 236, 255, 0.12), rgba(255, 197, 99, 0.08)),
    rgba(255, 255, 255, 0.04);
}

.pro-modal__avatar {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-amber));
  color: #081018;
  font-family: var(--font-display);
  font-weight: 900;
}

.pro-modal__eyebrow {
  margin: 0 0 4px;
  color: var(--accent-amber);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pro-modal__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.1;
}

.pro-modal__sub {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

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

.pro-plan {
  position: relative;
  min-height: 124px;
  padding: 18px;
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}

.pro-plan--active {
  border-color: rgba(255, 197, 99, 0.7);
  background: rgba(255, 197, 99, 0.1);
}

.pro-plan__badge {
  position: absolute;
  top: -10px;
  left: 14px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 197, 99, 0.95);
  color: #2b2108;
  font-size: 11px;
  font-weight: 900;
}

.pro-plan__name,
.pro-plan__note {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
}

.pro-plan__price {
  display: block;
  margin: 12px 0 8px;
  color: var(--accent-amber);
  font-family: var(--font-display);
  font-size: 32px;
}

.pro-modal__section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin: 24px 0 12px;
  color: var(--text-primary);
  font-weight: 900;
}

.pro-modal__section-title span {
  width: 26px;
  height: 2px;
  border-radius: 999px;
  background: var(--accent-amber);
}

.pro-benefits {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pro-benefit {
  display: grid;
  grid-template-columns: 46px 1fr 16px;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(129, 236, 255, 0.08);
}

.pro-benefit__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 197, 99, 0.18);
  color: var(--accent-amber);
  font: 900 11px var(--font-display);
}

.pro-benefit h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.pro-benefit p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.pro-benefit__arrow {
  color: var(--text-muted);
  font-size: 24px;
}

.pro-modal__confirm {
  width: 100%;
  margin-top: 18px;
  padding: 15px 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #f5c667, #ffe4a3);
  color: #4b3507;
  font: 900 16px var(--font-display);
  cursor: pointer;
}

.pro-modal__status {
  margin: 12px 0 0;
  color: var(--accent-green);
  text-align: center;
  font-size: 13px;
}

@media (max-width: 640px) {
  .pro-modal {
    align-items: end;
    padding: 12px;
  }

  .pro-modal__panel {
    padding: 20px;
    border-radius: 22px 22px 14px 14px;
  }

  .pro-modal__plans {
    grid-template-columns: 1fr;
  }

  .pro-modal__hero {
    grid-template-columns: 1fr;
  }
}

/* Honest loading states for pages that hydrate from live backend data. */
.data-skeleton {
  position: relative;
  display: inline-block;
  overflow: hidden;
  width: 100%;
  min-height: 1em;
  border-radius: 4px;
  background: rgba(129, 236, 255, 0.08);
  vertical-align: middle;
}

.data-skeleton::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(129, 236, 255, 0.14), transparent);
  transform: translateX(-100%);
  animation: data-skeleton-shimmer 1.4s ease-in-out infinite;
}

.data-skeleton--value {
  width: min(132px, 72%);
  min-height: 1.05em;
}

.data-skeleton--line {
  width: min(260px, 84%);
  min-height: 0.8em;
}

.data-loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 88px;
  padding: 18px;
  border: 1px dashed rgba(129, 236, 255, 0.16);
  border-radius: var(--radius-md);
  background: rgba(129, 236, 255, 0.025);
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

.data-loading-state--compact {
  min-height: 52px;
  padding: 12px;
}

.data-unavailable {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

@keyframes data-skeleton-shimmer {
  to {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .data-skeleton::after {
    animation: none;
  }
}
