/* ===== 景桁产业智库 — 深色财经风 ===== */

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a2332;
  --bg-card-hover: #1f2b3d;
  --bg-input: #0d1321;
  --border: #2a3548;
  --border-light: #374357;

  --text-primary: #e8edf5;
  --text-secondary: #8b95a5;
  --text-muted: #5a6475;
  --text-accent: #60a5fa;

  --accent-blue: #3b82f6;
  --accent-blue-light: #60a5fa;
  --accent-green: #22c55e;
  --accent-red: #ef4444;
  --accent-amber: #f59e0b;
  --accent-purple: #a78bfa;
  --accent-cyan: #22d3ee;

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

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

html, body {
  height: 100%;
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#app {
  min-height: 100vh;
  padding-bottom: 70px; /* TabBar height */
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== TabBar ===== */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tab-bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.tab-bar-item.active {
  color: var(--accent-blue);
}

.tab-bar-item svg {
  width: 22px;
  height: 22px;
}

/* ===== Header ===== */
.page-header {
  padding: 16px 20px 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.page-header p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ===== Content ===== */
.content {
  padding: 16px 20px;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: background 0.2s;
}

.card:active {
  background: var(--bg-card-hover);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== Tags ===== */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.tag-blue { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue-light); }
.tag-green { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.tag-amber { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.tag-red { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.tag-purple { background: rgba(167, 139, 250, 0.15); color: var(--accent-purple); }

/* ===== Input ===== */
.search-box {
  position: relative;
  margin-bottom: 16px;
}

.search-box input {
  width: 100%;
  height: 44px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 16px 0 40px;
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}

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

.search-box input:focus {
  border-color: var(--accent-blue);
}

.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  z-index: 1;
}

/* 搜索建议下拉 */
.search-suggest {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  border-top: none;
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.suggest-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.suggest-item:hover {
  background: var(--bg-secondary);
}

.suggest-item + .suggest-item {
  border-top: 1px solid var(--border);
}

.suggest-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.suggest-code {
  font-size: 12px;
  color: var(--accent-blue);
  font-family: 'SF Mono', 'Menlo', monospace;
}

.suggest-market {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 1px 6px;
  border-radius: 3px;
}

/* ===== Button ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { opacity: 0.8; }

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

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

.btn-block {
  width: 100%;
}

/* ===== Loading ===== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Disclaimer ===== */
.disclaimer {
  margin: 20px;
  padding: 12px 16px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--accent-amber);
  line-height: 1.6;
}

/* ===== Empty ===== */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.empty-text {
  font-size: 14px;
}

/* ===== Finance Result (v3 — Card Modules) ===== */

/* 行情卡片 */
.fin-quote {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.fin-quote-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}
.fin-quote-period {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 6px;
  font-weight: 400;
}
.fin-quote-right {
  text-align: right;
}
.fin-quote-price {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.fin-quote-change {
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.fin-quote-amount {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}
.fin-quote-up { color: var(--accent-red); }
.fin-quote-down { color: var(--accent-green); }

/* 数据来源 + 缓存提示 */
.fin-source-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 0 2px;
}
.fin-source-text {
  font-size: 11px;
  color: var(--text-muted);
}
.fin-source-text svg {
  width: 12px;
  height: 12px;
  vertical-align: -1px;
  margin-right: 3px;
}
.fin-cache-hint {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  margin-left: auto;
  cursor: pointer;
}
.fin-cache-hint:active {
  background: var(--bg-card-hover);
}

/* 一句话结论 */
.fin-conclusion {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  line-height: 1.6;
}

/* 核心指标网格 */
.fin-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.fin-metric-item {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border: 1px solid var(--border);
}
.fin-metric-label {
  font-size: 11px;
  color: var(--text-muted);
}
.fin-metric-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* 分析模块卡片 */
.fin-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.fin-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.fin-section-title svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.fin-section-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* 主题色 */
.fin-section--conclusion .fin-section-title { color: var(--accent-amber); }
.fin-section--metrics .fin-section-title { color: var(--accent-blue); }
.fin-section--revenue .fin-section-title { color: var(--accent-green); }
.fin-section--profit .fin-section-title { color: var(--accent-cyan); }
.fin-section--management .fin-section-title { color: var(--accent-purple); }
.fin-section--industry .fin-section-title { color: var(--accent-blue); }
.fin-section--moat .fin-section-title { color: var(--accent-amber); }
.fin-section--risk .fin-section-title { color: var(--accent-red); }
.fin-section--valuation .fin-section-title { color: var(--accent-cyan); }

/* 风险模块特殊左边框 */
.fin-section--risk {
  border-left: 3px solid var(--accent-red);
}

/* 管理层信号列表 */
.fin-signal-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.fin-signal-list li {
  position: relative;
  padding-left: 14px;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.fin-signal-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-purple);
}

/* 免费额度用完 */
.fin-paywall {
  text-align: center;
  padding: 24px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.fin-paywall-icon {
  font-size: 28px;
  margin-bottom: 8px;
  opacity: 0.8;
}
.fin-paywall-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}
.fin-paywall-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.fin-paywall-price {
  display: inline-block;
  font-size: 13px;
  padding: 6px 16px;
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-amber);
  border-radius: 6px;
  font-weight: 500;
}

/* 免责声明 */
.fin-disclaimer {
  margin: 16px 0 0;
  padding: 10px 12px;
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* 使用次数 */
.fin-usage {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 16px;
}

/* 加载骨架 */
.fin-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  gap: 8px;
}
.fin-loading-text {
  font-size: 14px;
  color: var(--text-muted);
}

/* 错误状态 */
.fin-error {
  text-align: center;
  padding: 24px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.fin-error-icon {
  font-size: 28px;
  margin-bottom: 8px;
  opacity: 0.8;
}
.fin-error-text {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ===== Industry Map (v2 Flow Layout) ===== */
.flow-map {
  padding: 0;
}

.flow-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.flow-layer {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 0;
}

.flow-layer-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.flow-stage-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.flow-layer-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.flow-vitality-note {
  font-size: 11px;
}

.flow-bottleneck-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-red);
  background: rgba(239,68,68,0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

.flow-nodes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.flow-connector {
  text-align: center;
  color: var(--text-muted);
  font-size: 20px;
  padding: 4px 0;
  margin: 2px 0;
}

.chain-node {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.chain-node:active {
  background: var(--bg-card-hover);
  border-color: var(--accent-blue);
  transform: scale(0.98);
}

.chain-node.node-featured {
  border-width: 2px;
  background: var(--bg-card-hover);
}

.chain-node.node-followed {
  box-shadow: inset 0 0 0 1px var(--accent-amber);
}

.chain-node .name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.chain-node .quote-line {
  min-height: 16px;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.chain-node .code {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}

.chain-node .role {
  font-size: 11px;
  color: var(--accent-blue-light);
  margin-top: 3px;
}

.chain-node .rank-note {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.4;
}

.rank-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
}

.bottleneck-note {
  margin-top: 8px;
  padding: 6px 10px;
  background: rgba(239,68,68,0.06);
  border-radius: 4px;
  font-size: 11px;
  color: var(--accent-red);
  line-height: 1.4;
}

.insight-card {
  margin-bottom: 16px !important;
}

.guide-card .guide-content {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.guide-content p {
  margin: 8px 0;
}

.guide-content strong {
  color: var(--text-primary);
}

/* ===== Weekly Report ===== */
.weekly-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.weekly-card .date {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.weekly-card .headline {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.weekly-card .body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ===== Related Articles (推荐阅读) ===== */
.related-articles {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.related-articles .ra-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-purple);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.related-articles .ra-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.related-articles .ra-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 6px 8px;
  background: rgba(167, 139, 250, 0.06);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
}

.related-articles .ra-item:active {
  background: rgba(167, 139, 250, 0.12);
}

.related-articles .ra-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-purple);
  flex-shrink: 0;
  margin-top: 6px;
}

.related-articles .ra-text {
  flex: 1;
  min-width: 0;
}

.related-articles .ra-headline {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-articles .ra-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  gap: 6px;
  align-items: center;
}

.related-articles .ra-column {
  color: var(--accent-purple);
  font-weight: 500;
}

/* 产业级推荐阅读（在层级下方） */
.industry-related {
  margin-top: 16px;
  margin-bottom: 8px;
}

.industry-related .ir-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.industry-related .ir-header span {
  font-size: 14px;
}

.industry-related .ir-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.industry-related .ir-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-purple);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  cursor: pointer;
  transition: background 0.2s;
}

.industry-related .ir-item:active {
  background: var(--bg-card-hover);
}

.industry-related .ir-num {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-purple);
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  line-height: 1.4;
}

.industry-related .ir-text {
  flex: 1;
  min-width: 0;
}

.industry-related .ir-headline {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.industry-related .ir-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.industry-related .ir-column-tag {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(167, 139, 250, 0.12);
  color: var(--accent-purple);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ===== Responsive ===== */
@media (min-width: 640px) {
  .content {
    max-width: 640px;
    margin: 0 auto;
  }
}
