/* 工作台布局：不改配色、不隐藏顶部「输入一个标题」 */
/* 详情页第一块是「全平台自动分发」，吸顶会盖住同页 GEO，所以只在非 run 页吸顶 */
html:not(.sf-run) main.mx-auto.max-w-\[1300px\] > div:first-child {
  position: sticky;
  top: 56px;
  z-index: 35;
  background: hsl(var(--card, 0 0% 100%) / 0.96);
  backdrop-filter: blur(8px);
}
html.sf-run main.mx-auto.max-w-\[1300px\] > div:first-child {
  position: static !important;
  top: auto !important;
  z-index: auto !important;
  backdrop-filter: none;
}

/* 创作工具：避免 hidden 竞态把功能区再次藏掉 */
html.sf-tab-tools #sf-tools-panel {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* 数据中心：标题独占一行，筛选/搜索下一行，表全宽 */
#history > div:first-child > .flex {
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 12px !important;
}
#history > div:first-child > .flex > div:last-child {
  width: 100%;
  justify-content: flex-start;
}
#history .sf-wb-table {
  margin: 0;
  border: none;
  border-top: 1px solid rgba(15, 23, 42, .08);
  border-radius: 0;
  box-shadow: none;
  max-height: min(62vh, 680px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.sf-wb-table {
  margin: 12px 0 4px;
  overflow: auto;
  max-height: min(62vh, 680px);
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  -webkit-overflow-scrolling: touch;
}
.sf-wb-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 720px;
  font-variant-numeric: tabular-nums;
}
.sf-wb-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  color: #64748b;
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 12px;
  border-bottom: 1px solid rgba(15, 23, 42, .06);
  white-space: nowrap;
}
.sf-wb-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, .05);
  color: #0f172a;
}
.sf-wb-table tbody tr { cursor: pointer; }
.sf-wb-table tbody tr:hover td { background: #f8fafc; }
.sf-wb-table tbody tr:last-child td { border-bottom: none; }
.sf-wb-table .sf-wb-st {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.sf-wb-table .sf-wb-st::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.sf-wb-table .sf-wb-st-done { background: #ecfdf5; color: #059669; }
.sf-wb-table .sf-wb-st-fail { background: #fef2f2; color: #dc2626; }
.sf-wb-table .sf-wb-st-run { background: #eff6ff; color: #2563eb; }
.sf-wb-table .sf-wb-st-other { background: #f1f5f9; color: #475569; }
.sf-wb-table .sf-wb-title {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.sf-wb-table .sf-wb-detail {
  color: #0ea5e9;
  font-weight: 600;
  white-space: nowrap;
}

/* GEO 优化：最近项目嵌在当前空态卡片内，不另开一块 */
.sf-geo-recent { padding: 20px 24px 24px; }
.sf-geo-recent-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.sf-geo-recent-hd p {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}
.sf-geo-recent-hd a {
  font-size: 13px;
  color: #0ea5e9;
  text-decoration: none;
  font-weight: 500;
}
.sf-geo-item {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
  padding: 12px 16px;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  text-align: left;
}
.sf-geo-item:hover { border-color: rgba(14, 165, 233, .35); }
.sf-geo-item .t {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sf-geo-item .m {
  margin: 4px 0 0;
  font-size: 12px;
  color: #64748b;
}
#sf-intel-dash { display: none !important; }
.sf-tools-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 900px) {
  .sf-tools-split {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
  }
  .sf-tools-split > div {
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 12px;
    padding: 14px 14px 12px;
    background: #fff;
  }
}

/* UX12：压缩工作台首屏，避免 800px 英雄区把「GEO/创作/数据」顶出视口 */
html { overflow-x: clip; }
body { overflow-x: hidden; }

html:not(.sf-run) .min-h-screen.bg-muted\/20 > .relative.overflow-hidden.border-b > .relative.mx-auto {
  padding-top: 8px !important;
  padding-bottom: 4px !important;
}
html:not(.sf-run) .min-h-screen.bg-muted\/20 .max-w-5xl.py-16 {
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}
html:not(.sf-run) .min-h-screen.bg-muted\/20 .text-center.space-y-5.mb-10 {
  margin-bottom: 12px !important;
}
html:not(.sf-run) .min-h-screen.bg-muted\/20 .max-w-5xl h1 {
  font-size: clamp(22px, 2.6vw, 30px) !important;
  line-height: 1.28 !important;
}
html:not(.sf-run) .min-h-screen.bg-muted\/20 .grid.grid-cols-1.sm\:grid-cols-3.mb-8 {
  margin-bottom: 12px !important;
}

/* 右下角悬浮：客服 / 每日效果 / 公告纵向错开，互不遮挡 */
#sf-chat-root { right: 18px !important; bottom: 18px !important; }
#sf-effects-btn { right: 18px !important; bottom: 86px !important; }
#sf-announce-entry { right: 18px !important; bottom: 138px !important; }
#sf-chat-panel { right: 18px !important; bottom: 86px !important; }

@media (max-width: 640px) {
  #sf-chat-root { right: 12px !important; bottom: 12px !important; }
  #sf-effects-btn { right: 12px !important; bottom: 76px !important; }
  #sf-announce-entry { right: 12px !important; bottom: 126px !important; }
  #sf-chat-panel {
    right: 8px !important;
    left: 8px !important;
    width: auto !important;
    max-width: none !important;
    bottom: 76px !important;
    max-height: calc(100vh - 110px) !important;
  }
}

.sf-geo-item, .sf-geo-item .t { min-width: 0; }

@media (max-width: 960px) {
  header .hidden.lg\:flex { max-width: min(52vw, 480px); overflow-x: auto; }
}
