/* TraceAI 全局样式 */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "微软雅黑", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  background: #0a0a0a;
  color: #e8e8e8;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* 顶栏改为 fixed 定位，需为内容预留其高度，避免被遮挡 */
  padding-top: 64px;
  /* 底栏改为 fixed 定位，预留底部空间避免内容被遮挡（留足余量） */
  padding-bottom: 66px;
}

/* === 顶栏 === */
/* 顶栏使用 fixed 定位，始终固定在视口顶部——向下滚动（含滚到最底）都可见。
   其内容由 #topbar-mount 渲染；body 已预留 padding-top:64px 防止内容被遮挡。 */
#topbar-mount {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: linear-gradient(180deg, #141414 0%, #0e0e0e 100%);
  border-bottom: 2px solid #ff6b1a;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}
.topbar {
  background: transparent;
  border-bottom: none;
  box-shadow: none;
}
.topbar-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
}
.brand-logo .ctr-icon {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: -1px;
  object-fit: contain;
  padding: 0;
}
.brand-logo .trace-name {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand-logo .trace-name .main {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
}
.brand-logo .trace-name .sub {
  font-size: 10px;
  color: #ff6b1a;
  letter-spacing: 1.5px;
  font-weight: 600;
}
.nav {
  display: flex;
  gap: 4px;
  margin-left: 16px;
  flex: 1;
  flex-wrap: nowrap;
  overflow: hidden;
}
.nav a {
  color: #b3b3b3;
  text-decoration: none;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 6px;
  transition: all 0.2s;
  white-space: nowrap;
  position: relative;
}
.nav a:hover { color: #fff; background: rgba(255, 107, 26, 0.08); }
.nav a.active {
  color: #ff6b1a;
  background: rgba(255, 107, 26, 0.12);
  font-weight: 600;
}
.nav a.active::after {
  content: '';
  position: absolute;
  bottom: -22px;
  left: 16px;
  right: 16px;
  height: 2px;
  background: #ff6b1a;
}
.user-area {
  display: flex;
  align-items: center;
  gap: 12px;
}
.btn-login {
  background: transparent;
  color: #ff6b1a;
  border: 1px solid #ff6b1a;
  padding: 6px 18px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-login:hover {
  background: #ff6b1a;
  color: #fff;
}

/* === 次顶栏 === */
.subtopbar {
  background: #161616;
  border-bottom: 1px solid #2a2a2a;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.subtopbar .sub-title {
  display: flex;
  flex-direction: column;
}
.subtopbar .sub-title h2 {
  font-size: 20px;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.subtopbar .sub-title .desc {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
  letter-spacing: 0.3px;
}
.subtopbar .sub-title .desc::before {
  content: '· ';
  color: #ff6b1a;
}
.subtopbar-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.subtopbar-controls .control {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #aaa;
}
.subtopbar-controls select,
.subtopbar-controls input {
  background: #0a0a0a;
  color: #fff;
  border: 1px solid #2a2a2a;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  outline: none;
}
.subtopbar-controls select:focus,
.subtopbar-controls input:focus {
  border-color: #ff6b1a;
}

/* 日期下拉框（统一模式） */
.date-select {
  background: #0a0a0a;
  color: #fff;
  border: 1px solid #2a2a2a;
  padding: 6px 30px 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23ff6b1a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-width: 110px;
}
.date-select:focus { border-color: #ff6b1a; }
.date-select:hover { border-color: #ff8c42; }
.subtopbar-controls label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
}
.subtopbar-controls input[type="checkbox"] {
  accent-color: #ff6b1a;
  width: 14px;
  height: 14px;
}

/* === 页面级日期选择器（生态图右上角） === */
.page-date-control {
  position: absolute;
  top: 80px;
  right: 24px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 10, 10, 0.85);
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  padding: 4px 8px;
  backdrop-filter: blur(4px);
}
.page-date-control .control {
  font-size: 11px;
  color: #aaa;
}
.page-date-control .date-select {
  min-width: 110px;
  padding: 6px 30px 6px 12px;
  font-size: 13px;
}

/* === 图表右上角时间筛选器 === */
.chart-date-control {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 10, 10, 0.85);
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  padding: 4px 8px;
  backdrop-filter: blur(4px);
}
.chart-date-control .control {
  font-size: 11px;
  color: #aaa;
}
.chart-date-control .date-select {
  min-width: 110px;
  padding: 6px 30px 6px 12px;
  font-size: 13px;
}
.chart-card { position: relative; }
.card { position: relative; }

/* === 内容 === */
main {
  position: relative;
  flex: 1;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  padding: 24px;
}

/* === 底栏 === */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: linear-gradient(180deg, #141414 0%, #0e0e0e 100%);
  border-top: 1px solid #2a2a2a;
  min-height: 40px;
  padding: 5px 24px;
  display: flex;
  align-items: center;
}
/* 产品名（左）与公司名（右）同一行左右分布 */
.footer .footer-text {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 16px;
}
.footer .footer-name {
  color: #ff6b1a;
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 13px;
}
.footer .footer-company {
  color: #bbb;
  font-size: 12px;
}

/* === 右侧悬浮框（全局，所有页面共用） === */
.floating-widget-new {
  position: fixed;
  right: 20px;
  bottom: 56px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
/* 收起态（默认）：只保留小人图标，透明背景，不影响阅读 */
.float-trigger {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.3s;
  overflow: hidden;
}
.float-trigger:hover { transform: scale(1.08); }
.float-trigger .mascot-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}
/* 展开面板：联系我们 + 二维码 */
.float-panel {
  width: 200px;
  background: #161616;
  border: 1px solid #2f2f2f;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.float-panel.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.float-panel .float-title {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}
.float-panel .float-title::before {
  content: '📞 ';
}
.float-panel .float-qrcode {
  background: #fff;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 10px;
}
.float-panel .float-qrcode img {
  width: 100%;
  height: auto;
  display: block;
}
.float-panel .float-email {
  color: #ff8c42;
  font-size: 12px;
  word-break: break-all;
}

/* === 通用卡片 === */
.card {
  background: linear-gradient(180deg, #161616 0%, #121212 100%);
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title::before {
  content: '';
  width: 4px;
  height: 16px;
  background: #ff6b1a;
  border-radius: 2px;
}
.card-subtitle {
  font-size: 12px;
  color: #888;
  margin-bottom: 16px;
  padding-left: 12px;
}

/* === 通用按钮 === */
.btn {
  background: #ff6b1a;
  color: #fff;
  border: none;
  padding: 6px 16px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn:hover { background: #ff8c42; }
.btn-ghost {
  background: transparent;
  color: #ff6b1a;
  border: 1px solid #ff6b1a;
}
.btn-ghost:hover { background: rgba(255, 107, 26, 0.1); }

/* === Loading 状态 === */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  color: #666;
  font-size: 13px;
}
.loading::before {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid #2a2a2a;
  border-top-color: #ff6b1a;
  border-radius: 50%;
  margin-right: 8px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === 响应式 === */
@media (max-width: 1024px) {
  .nav a { padding: 8px 10px; font-size: 13px; }
  .subtopbar { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 768px) {
  .topbar-inner { padding: 0 12px; gap: 12px; }
  .nav { display: none; }
  .floating-widget-new { right: 12px; bottom: 52px; }
  .float-panel { width: 170px; }
  main { padding: 12px; }
}
