/* 工作台布局：不改配色、不隐藏顶部「输入一个标题」 */
/* 详情页第一块是「全平台自动分发」，吸顶会盖住同页 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(72vh, 820px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.sf-wb-table {
  margin: 8px 0 4px;
  overflow: auto;
  max-height: min(72vh, 820px);
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 12px;
  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: 12.5px;
  min-width: 640px;
  font-variant-numeric: tabular-nums;
}
.sf-wb-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f1f5f9;
  color: #64748b;
  text-align: left;
  padding: 7px 12px;
  font-weight: 650;
  font-size: 11px;
  letter-spacing: .02em;
  border-bottom: 1px solid rgba(15, 23, 42, .08);
  white-space: nowrap;
}
.sf-wb-table tbody td {
  padding: 7px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, .045);
  color: #0f172a;
  vertical-align: middle;
  line-height: 1.35;
}
.sf-wb-table tbody tr { cursor: pointer; }
.sf-wb-table tbody tr:nth-child(even) td { background: #fafbfc; }
.sf-wb-table tbody tr:hover td { background: #f0f9ff; }
.sf-wb-table tbody tr:last-child td { border-bottom: none; }
.sf-wb-table .sf-wb-st {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.sf-wb-table .sf-wb-st::before {
  content: '';
  width: 5px;
  height: 5px;
  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: 440px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 550;
}
.sf-wb-table .sf-wb-detail {
  color: #0ea5e9;
  font-weight: 650;
  white-space: nowrap;
  font-size: 12px;
}
.sf-wb-table th.sf-wb-col-score,
.sf-wb-table td.sf-wb-col-score,
.sf-wb-table th.sf-wb-col-eng,
.sf-wb-table td.sf-wb-col-eng,
.sf-wb-table th.sf-wb-col-prog,
.sf-wb-table td.sf-wb-col-prog { text-align: center; }
@media (max-width: 960px) {
  .sf-wb-table th.sf-wb-col-eng,
  .sf-wb-table td.sf-wb-col-eng { display: none; }
  .sf-wb-table table { min-width: 560px; }
}
@media (max-width: 720px) {
  .sf-wb-table th.sf-wb-col-prog,
  .sf-wb-table td.sf-wb-col-prog { display: none; }
  .sf-wb-table .sf-wb-title { max-width: 42vw; }
  .sf-wb-table thead th,
  .sf-wb-table tbody td { padding: 6px 10px; }
}

/* 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-tools-dock { right: 18px !important; bottom: 16px !important; z-index: 2147483640 !important; }
#sf-chat-root { right: 18px !important; bottom: 84px !important; z-index: 2147483000 !important; }
#sf-effects-btn { right: 18px !important; bottom: 148px !important; }
#sf-announce-entry { right: 18px !important; bottom: 200px !important; }
#sf-chat-panel { right: 18px !important; bottom: 92px !important; }

@media (max-width: 640px) {
  #sf-tools-dock { right: 12px !important; bottom: 12px !important; }
  #sf-chat-root { right: 12px !important; bottom: 76px !important; }
  #sf-effects-btn { right: 12px !important; bottom: 136px !important; }
  #sf-announce-entry { right: 12px !important; bottom: 186px !important; }
  #sf-chat-panel {
    right: 8px !important;
    left: 8px !important;
    width: auto !important;
    max-width: none !important;
    bottom: 84px !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; }
}

/* ===== SF-HERO-FIX: title + blob (not a redesign) ===== */
/* 1) Keep「全自动完成 GEO 全链路」always visible (no transparent/clip dependency) */
.min-h-screen h1 span.bg-clip-text,
.min-h-screen h1 span.text-transparent,
.min-h-screen h1 .bg-gradient-to-r.bg-clip-text {
  color: #22314f !important;
  -webkit-text-fill-color: #22314f !important;
  background-image: none !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
}

/* 2) Broken Tailwind opacity duplicates fall back to solid --primary → navy blob.
      Force real alpha for decorative orbs used in workbench hero. */
.bg-primary\/5 { background-color: rgba(34, 49, 79, 0.05) !important; }
.bg-primary\/8 { background-color: rgba(34, 49, 79, 0.08) !important; }
.bg-primary\/10 { background-color: rgba(34, 49, 79, 0.10) !important; }
.bg-primary\/15 { background-color: rgba(34, 49, 79, 0.15) !important; }
.bg-primary\/20 { background-color: rgba(34, 49, 79, 0.20) !important; }
.bg-primary\/25 { background-color: rgba(34, 49, 79, 0.25) !important; }
.bg-primary\/\[0\.03\] { background-color: rgba(34, 49, 79, 0.03) !important; }
.bg-primary\/\[0\.06\] { background-color: rgba(34, 49, 79, 0.06) !important; }
.bg-primary\/\[0\.08\] { background-color: rgba(34, 49, 79, 0.08) !important; }

/* Soften hero orbs further so they never read as a solid navy shape */
.min-h-screen.bg-muted\/20 .pointer-events-none.absolute.rounded-full.blur-3xl,
.min-h-screen.bg-muted\/20 .absolute.rounded-full.blur-3xl.pointer-events-none {
  opacity: 0.55 !important;
  max-width: 70vw;
}

/* ===== SF-UX-R6: density / shell / floats (keep hero content) ===== */
[data-sf-extra-shell="1"] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  content-visibility: hidden;
}

/* Tab 行吸顶时略提层级，避免被输入卡阴影盖住 */
html:not(.sf-run) main .flex.flex-wrap.items-center.gap-2.rounded-2xl.border {
  z-index: 40 !important;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
}

/* 输入主卡稍加重，首屏焦点更清晰 */
html:not(.sf-run) .min-h-screen.bg-muted\/20 .rounded-2xl.border.bg-card,
html:not(.sf-run) .min-h-screen.bg-muted\/20 .rounded-3xl.border.bg-card {
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

/* 矮屏：再压一点英雄区上下白边，让 Tab 更容易进首屏 */
@media (max-height: 820px) {
  html:not(.sf-run) .min-h-screen.bg-muted\/20 .max-w-5xl.py-16 {
    padding-top: 4px !important;
    padding-bottom: 4px !important;
  }
  html:not(.sf-run) .min-h-screen.bg-muted\/20 .text-center.space-y-5.mb-10 {
    margin-bottom: 8px !important;
  }
  html:not(.sf-run) .min-h-screen.bg-muted\/20 .grid.grid-cols-1.sm\:grid-cols-3.mb-8 {
    margin-bottom: 8px !important;
  }
  html:not(.sf-run) .min-h-screen.bg-muted\/20 .max-w-5xl h1 {
    font-size: clamp(20px, 2.4vw, 28px) !important;
  }
}

/* 窄屏：藏装饰光斑，减噪 + 省绘制 */
@media (max-width: 720px) {
  .min-h-screen.bg-muted\/20 .pointer-events-none.absolute.rounded-full.blur-3xl,
  .min-h-screen.bg-muted\/20 .absolute.rounded-full.blur-3xl.pointer-events-none {
    display: none !important;
  }
  html:not(.sf-run) .min-h-screen.bg-muted\/20 .max-w-5xl h1 {
    font-size: 22px !important;
  }
}

/* 最近执行条目更紧凑 */
.sf-geo-item { padding: 10px 14px !important; margin-bottom: 6px !important; }
.sf-geo-recent { padding: 14px 20px 18px !important; }

/* 空 chat 根节点不占点击层 */
#sf-chat-root:empty,
#sf-chat-root:not(:has(*)) {
  pointer-events: none !important;
}
