/**
 * 前台统一现代主题（主题色 #00b7f0 / #33c5f3 / #7dd3fc / #e8f8fd / #f5f6fa）
 * 视觉 + 疏密度基准（以个人中心舒适页为准）
 */
:root {
  --fm-purple: #00b7f0;
  --fm-purple-mid: #33c5f3;
  --fm-lavender: #7dd3fc;
  --fm-purple-soft: #e8f8fd;
  --fm-purple-softer: #f3fbfe;
  --fm-theme: #00b7f0;
  --fm-theme-mid: #33c5f3;
  --fm-theme-deep: #0099cc;
  --fm-bg: #f5f6fa;
  --fm-surface: #ffffff;
  --fm-border: #eef0f4;
  --fm-text: #1f2937;
  --fm-muted: #6b7280;
  --fm-radius: 14px;
  --fm-radius-lg: 18px;
  --fm-shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.04);
  --fm-shadow: 0 10px 32px rgba(0, 183, 240, 0.10);
  --fm-shadow-hover: 0 14px 40px rgba(0, 183, 240, 0.14);

  /* —— 疏密度基准（个人中心）—— */
  --fm-page-max: 1360px;
  --fm-page-pad: 28px 32px 48px;
  --fm-page-pad-sm: 18px 16px 32px;
  --fm-card-pad: 24px 28px;
  --fm-card-radius: 12px;
  --fm-panel-pad: 28px 32px 40px;
  --fm-table-pad-y: 14px;
  --fm-table-pad-x: 16px;
  --fm-tab-pad: 14px 18px;
  --fm-input-pad: 12px 14px;
  --fm-gap: 20px;
  --fm-gap-lg: 24px;
  --fm-hint-lh: 1.65;
}

/* 通用页壳（可选挂载） */
.fm-page,
.page-wrap.fm-comfort {
  max-width: var(--fm-page-max);
  margin: 0 auto;
  padding: var(--fm-page-pad);
  box-sizing: border-box;
}

.fm-card {
  background: var(--fm-surface);
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-card-radius);
  padding: var(--fm-card-pad);
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .fm-page,
  .page-wrap.fm-comfort {
    padding: var(--fm-page-pad-sm);
  }
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif !important;
  background-color: var(--fm-bg) !important;
  background-image:
    radial-gradient(1100px 520px at 6% -12%, rgba(0, 183, 240, 0.24), transparent 58%),
    radial-gradient(900px 480px at 100% -4%, rgba(0, 183, 240, 0.10), transparent 52%),
    linear-gradient(180deg, #f3fbfe 0%, #f5f6fa 38%, #f5f6fa 100%) !important;
  color: var(--fm-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* 顶栏：毛玻璃 + 轻投影 */
.top-nav {
  background: rgba(255, 255, 255, 0.78) !important;
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid rgba(238, 240, 244, 0.9) !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 6px 24px rgba(0, 183, 240, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* 顶栏布局兜底：避免个别页缺 CSS 导致右侧挤没、「下载」只露「下」 */
.top-nav .nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.top-nav .nav-left,
.top-nav .nav-right {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.top-nav .nav-left {
  flex: 1 1 auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.top-nav .nav-left::-webkit-scrollbar {
  display: none;
}

.top-nav .nav-right {
  flex: 0 0 auto;
  flex-shrink: 0;
}

.top-nav .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border-radius: 10px !important;
  font-size: 13px;
  color: #4b5563;
  text-decoration: none;
  white-space: nowrap;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease !important;
}

.top-nav .nav-link .icon {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.top-nav .nav-link:hover {
  background: rgba(232, 248, 253, 0.65) !important;
  color: #0099cc !important;
}

.top-nav .nav-link.active {
  background: linear-gradient(135deg, #e8f8fd 0%, #f3fbfe 100%) !important;
  color: #00b7f0 !important;
  font-weight: 600 !important;
  box-shadow: 0 0 0 1px rgba(0, 183, 240, 0.16), 0 4px 14px rgba(0, 183, 240, 0.08);
}

.top-nav .chevron {
  font-size: 10px;
  color: #9ca3af;
}

.top-nav .nav-pill,
.top-nav .nav-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px !important;
  font-size: 13px;
  color: #4b5563;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.top-nav .nav-pill:hover,
.top-nav .nav-user-btn:hover {
  border-color: #d1d5db !important;
  box-shadow: none;
}

/* 去掉浏览器默认粗蓝焦点框（Win/Edge 尤其明显） */
.top-nav .nav-pill,
.top-nav .nav-user-btn,
.top-nav .nav-link,
.top-nav button {
  outline: none !important;
  -webkit-tap-highlight-color: transparent;
}

.top-nav .nav-pill:focus,
.top-nav .nav-pill:focus-visible,
.top-nav .nav-user-btn:focus,
.top-nav .nav-user-btn:focus-visible,
.top-nav .front-identity-pill:focus,
.top-nav .front-identity-pill:focus-visible,
.top-nav button:focus,
.top-nav button:focus-visible {
  outline: none !important;
  outline-offset: 0 !important;
  box-shadow: none !important;
}

.top-nav .nav-link .dot,
.top-nav .nav-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f472b6;
  flex-shrink: 0;
  box-shadow: none;
}

.top-nav .nav-user-btn .avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fca5a5, #f87171);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
  padding: 0;
}

.top-nav .nav-user-btn .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.top-nav .nav-dropdown-wrap {
  position: relative;
}

.top-nav .nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  padding: 6px 0;
  z-index: 200;
}

.top-nav .nav-dropdown-wrap.open .nav-dropdown-menu {
  display: block;
}

.top-nav .front-more-wrap {
  position: relative;
  flex: 0 0 auto;
  z-index: 220;
}

.top-nav .front-more-menu {
  right: 0;
  left: auto;
  width: 220px;
  max-height: min(440px, calc(100vh - 84px));
  overflow-y: auto;
  z-index: 230;
}

.top-nav .front-more-menu .nav-dropdown-item:nth-child(4),
.top-nav .front-more-menu .nav-dropdown-item:nth-child(7) {
  border-bottom: 1px solid #eef0f4;
}

.top-nav .nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
}

.top-nav .nav-dropdown-item:hover {
  background: #f9fafb;
}

.top-nav .nav-dropdown-sep {
  height: 1px;
  background: #eef0f4;
  margin: 4px 0;
}

.top-nav .front-identity-pill {
  background: #f3f4f6;
  border: 1px solid #e5e7eb !important;
  color: #374151;
  font-weight: 600;
  box-shadow: none !important;
}

.top-nav .nav-dropdown-wrap.open .front-identity-pill {
  background: #f8fafc;
  border-color: #cbd5e1 !important;
  box-shadow: none !important;
}

.top-nav .front-identity-menu {
  min-width: 280px;
}

.top-nav .front-identity-hint {
  font-size: 12px;
  color: #64748b;
  cursor: default;
  font-weight: 500;
}

.top-nav .front-identity-hint:hover {
  background: transparent;
}

.top-nav .front-identity-item .fi-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.top-nav .front-identity-item .fi-main b {
  font-size: 13px;
  color: #0f172a;
}

.top-nav .front-identity-item .fi-main small {
  font-size: 11px;
  color: #94a3b8;
  white-space: normal;
  line-height: 1.35;
}

.top-nav .front-identity-item .fi-meta {
  font-size: 11px;
  color: #0284c7;
  flex-shrink: 0;
}

.top-nav .front-identity-item.is-active {
  background: #f0f9ff;
}

.top-nav .front-identity-item.is-locked .fi-meta {
  color: #b45309;
}

.top-nav .front-identity-item.is-agent-dev .fi-dot {
  background: #06b6d4;
}

.top-nav .front-identity-item.is-agent-dev:hover {
  background: #ecfeff;
}

.top-nav .front-identity-item .fi-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}

.top-nav .front-identity-item.is-active .fi-dot {
  background: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

@media (max-width: 1100px) {
  .top-nav .nav-right > .nav-link:not(.nav-user-btn),
  .top-nav .nav-right > a.nav-link {
    padding: 7px 8px;
  }

  .top-nav .nav-right > .nav-link span:not(.icon):not(.dot):not(.chevron):not(.avatar),
  .top-nav .nav-right > a.nav-link span:not(.icon):not(.dot):not(.chevron) {
    display: none;
  }

  .top-nav .nav-pill span:not(.dot):not(.chevron) {
    display: none;
  }
}

/* 主内容区节奏 */
.page-wrap,
.main-content,
.saas-main,
.auth-page,
.model-main {
  position: relative;
  z-index: 1;
}

/* 常见卡片 / 面板 */
.plans-shell,
.plan-card,
.panel-card,
.panel,
.content-card,
.saas-card,
.metric-card,
.login-box,
.auth-box,
.auth-box--unified,
.register-box,
.skill-card,
.learn-card,
.download-card,
.node-card,
.chat-side-panel {
  border-radius: var(--fm-radius) !important;
  box-shadow: var(--fm-shadow-sm);
  transition: box-shadow 0.22s ease, transform 0.22s ease, border-color 0.22s ease;
}

.plans-shell:hover,
.panel-card:hover,
.skill-card:hover,
.learn-card:hover,
.download-card:hover,
.plan-card:hover {
  box-shadow: var(--fm-shadow);
}

.saas-consumer .plans-shell {
  border-radius: var(--fm-radius-lg) !important;
  border-color: #c5ebf8 !important;
  background: linear-gradient(180deg, #ffffff 0%, #f7fcfe 100%) !important;
  box-shadow: var(--fm-shadow) !important;
}

.saas-consumer .plan-card.featured {
  box-shadow: 0 12px 36px rgba(0, 183, 240, 0.14) !important;
}

.saas-hero h1,
.page-head h1,
.page-header h1,
.view-page-head h2 {
  letter-spacing: -0.02em;
}

.hero-eyebrow {
  color: var(--fm-purple-mid) !important;
}

/* 主按钮气质（尽量不破坏既有尺寸） */
.btn-primary,
.btn-buy,
.plan-cta,
.submit-btn,
.login-btn,
.auth-submit,
.recharge-btn {
  border-radius: 10px !important;
  background-image: linear-gradient(135deg, var(--fm-purple-mid) 0%, var(--fm-purple) 100%) !important;
  box-shadow: 0 6px 18px rgba(0, 183, 240, 0.28);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease !important;
}

.btn-primary:hover,
.btn-buy:hover,
.plan-cta:hover,
.submit-btn:hover,
.login-btn:hover,
.auth-submit:hover {
  filter: brightness(1.03);
  box-shadow: 0 10px 24px rgba(0, 183, 240, 0.34);
}

.btn-secondary,
.btn-ghost,
.btn-outline {
  border-radius: 10px !important;
  transition: border-color 0.2s, color 0.2s, background 0.2s, box-shadow 0.2s;
}

.btn-secondary:hover,
.btn-outline:hover {
  border-color: #9adcf5 !important;
  color: var(--fm-purple) !important;
  background: var(--fm-purple-softer) !important;
}

/* 表单聚焦 */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="search"],
select,
textarea {
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #9adcf5 !important;
  box-shadow: 0 0 0 3px rgba(0, 183, 240, 0.14) !important;
  outline: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  outline-offset: 0;
}

/* 链接色统一到主题青蓝 */
a {
  text-underline-offset: 2px;
}

/* Tab / pill 选中态 */
.track-tab.active,
.tab-item.active,
.filter-chip.active,
.seg-btn.active {
  color: var(--fm-purple) !important;
  background: var(--fm-purple-soft) !important;
  box-shadow: 0 0 0 1px rgba(0, 183, 240, 0.12);
}

/* 滚动条轻微品牌感（WebKit） */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 183, 240, 0.45);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 183, 240, 0.55);
  background-clip: padding-box;
  border: 2px solid transparent;
}

/* 页面分区轻分隔 */
.section-block,
.page-section,
.content-section {
  border-radius: var(--fm-radius);
}

/* 表格 / 列表头略柔化 */
table thead th,
.table th,
.data-table th {
  color: #0369a1;
  background: linear-gradient(180deg, #f3fbfe 0%, #e8f8fd 100%);
}

/* 空状态 / 提示块 */
.empty-state,
.hint-box,
.info-tip {
  border-radius: var(--fm-radius) !important;
  border-color: #c5ebf8 !important;
  background: rgba(243, 251, 254, 0.55) !important;
}

/* 登录页容器 */
.auth-page,
.login-page,
.register-page {
  min-height: 100vh;
}

.auth-box,
.login-box,
.register-box,
.auth-box--unified {
  border: 1px solid #c5ebf8 !important;
  background: rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: blur(8px);
  box-shadow: var(--fm-shadow) !important;
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
