:root {
  --line: #c9d3e0;
  --muted: #6b7a90;
  --accent: #2563eb;
  --bg: #f5f7fa;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  padding: 14px;
  background: var(--bg);
  font:
    14px/1.6 "Microsoft YaHei",
    system-ui,
    sans-serif;
  color: #1f2937;
}
h1 {
  font-size: 18px;
  margin: 0 0 12px;
}
/* 左侧排行榜与右侧工作区 */
.layout {
  display: grid;
  grid-template-columns: 3fr 9fr;
  gap: 12px;
  align-items: stretch;
}
.side,
.main {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* 高频标签卡片由列表自身高度决定 */
.side > .card:last-child {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
/* 中间行（图片/饼图）吃掉主列剩余高度，使两张卡的底边与左列对齐 */
.main > .split {
  flex: 1 1 auto;
  min-height: 0;
}
/* 标签列表在卡片内滚动 */
.tag-list {
  flex: 0 0 auto;
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
  direction: ltr;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #b6c2d2 #f3f6fa;
}
.tag-list > table {
  direction: ltr;
}
/* 表头吸附：滚动时「标签名 / 频次」始终可见 */
.tag-list thead th {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.tag-list::-webkit-scrollbar {
  width: 8px;
}
.tag-list::-webkit-scrollbar-track {
  background: #f3f6fa;
  border-radius: 4px;
}
.tag-list::-webkit-scrollbar-thumb {
  background: #b6c2d2;
  border-radius: 4px;
  border: 1px solid #f3f6fa;
}
.tag-list::-webkit-scrollbar-thumb:hover {
  background: #8fa1b8;
}
.tag-foot {
  margin-top: 6px;
  font-size: 11px;
  text-align: right;
}
.row2 {
  display: grid;
  grid-template-columns: 5fr 3fr;
  gap: 12px;
}
/* 中间行：左 3fr（图片）/ 右 2fr（饼图+检索） */
.split {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 12px;
}
.split > .card {
  display: flex;
  flex-direction: column;
}
.search {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.search input {
  flex: 1 1 110px;
  min-width: 0;
  padding: 5px 8px;
  font-size: 13px;
}
/* 带候选列表的输入框：右边留出下拉箭头的空间 */
.search .q-input {
  padding-right: 22px;
  background: #fff
    url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0h10L5 6z' fill='%236b7a90'/%3E%3C/svg%3E")
    no-repeat right 8px center;
}
.search button {
  padding: 5px 10px;
  font-size: 13px;
  white-space: nowrap;
}
#searchInfo {
  margin: -4px 0 8px;
  font-size: 12px;
  min-height: 16px;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.card h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 8px;
  text-align: center;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
td {
  padding: 4px 6px;
  border-bottom: 1px solid #edf1f6;
}
td:last-child {
  text-align: right;
  color: var(--muted);
}
tbody tr:hover {
  background: #f0f6ff;
}
.bar {
  height: 4px;
  background: #e6ecf5;
  border-radius: 2px;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  background: var(--accent);
}
/* 筛选排序表：数据来源标签 + 词条下拉框 */
.src-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.src-tag {
  background: #e0edff;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  max-width: 46%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-select {
  flex: 1;
  min-width: 0;
  padding: 3px 6px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #334155;
}
#filters td.work {
  text-align: left;
  padding: 7px 6px;
}
/* 排序表的表头：作品名 / 频次 */
.rank-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-align: left;
  padding: 0 6px 6px;
  border-bottom: 1px solid var(--line);
}
.rank-table th:last-child {
  text-align: right;
}
.work-name {
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.work-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
/* 是否AI 分段开关 */
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}
.seg button {
  background: #fff;
  color: #334155;
  border-radius: 0;
  padding: 4px 10px;
  font-size: 12px;
  border-right: 1px solid var(--line);
}
.seg button:last-child {
  border-right: 0;
}
.seg button.on {
  background: var(--accent);
  color: #fff;
}
.title {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.title b {
  font-size: 22px;
}
.kw {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 12px;
  background: #fff;
}
.muted {
  color: var(--muted);
  font-size: 12px;
}
input,
button {
  font: inherit;
}
input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
button {
  cursor: pointer;
  border: 0;
  border-radius: 6px;
  padding: 6px 12px;
  background: var(--accent);
  color: #fff;
}
button.ghost {
  background: #eef2f7;
  color: #334155;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
/* 图片框：flex-basis 必须是 0，否则 <img> 会拿自身固有尺寸当基准，
     竖长图（600×1200）会把卡片→整行→整页顶高，横图又太矮。 */
figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 260px;
}
#preview {
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
  object-fit: contain;
  background: #eef2f7;
  border-radius: 6px;
}
/* 核心数据：当前作品的量化字段（渐变长方形进度条） */
.bars {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-top: 12px;
}
.bars.muted {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}
.bars::-webkit-scrollbar {
  width: 6px;
}
.bars::-webkit-scrollbar-thumb {
  background: #c3ccda;
  border-radius: 3px;
}
.metric-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.metric-head .muted {
  font-size: 11px;
}
.bar-group {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin: 10px 0 8px;
}
.bar-group:first-of-type {
  margin-top: 0;
}
.bar-item {
  margin-bottom: 10px;
}
.bar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 12px;
  line-height: 1.4;
}
.bar-name {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-val {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
}
.bar-track {
  height: 14px;
  margin-top: 4px;
  background: #eef2f7;
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.35s ease;
}
#toast {
  margin-top: 4px;
  font-size: 12px;
  min-height: 15px;
  color: var(--muted);
}
/* 输入 tag 采集：一行紧凑布局，单个 tag */
.tag-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.tag-row input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  padding: 4px 8px;
  font-size: 13px;
}
.tag-row button {
  padding: 4px 12px;
  font-size: 13px;
  white-space: nowrap;
}
/* 采集的 tag 单独一栏 */
.collected {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.c-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.chip {
  background: #eef2ff;
  color: #4338ca;
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 11px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip b {
  font-weight: 600;
  margin-left: 3px;
}
@media (max-width: 1100px) {
  .layout,
  .row2,
  .split {
    grid-template-columns: 1fr;
  }
}
/* 控制台组件布局 */
[hidden] {
  display: none !important;
}
body {
  max-width: 1680px;
  margin: auto;
}
label {
  display: block;
  font-size: 12px;
  color: #475569;
  margin-bottom: 8px;
}
select {
  font: inherit;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: #334155;
  max-width: 100%;
}
label input,
label select {
  display: block;
  width: 100%;
  margin-top: 4px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
  flex-wrap: wrap;
}
.error {
  color: #b91c1c !important;
  overflow-wrap: anywhere;
}
#datasetInfo,
#subtitle {
  overflow-wrap: anywhere;
}
.empty {
  display: grid;
  place-items: center;
  background: #eef2f7;
  min-height: 280px;
  padding: 24px;
  border-radius: 6px;
  color: #6b7a90;
  text-align: center;
}
#preview {
  max-height: 650px;
  min-height: 280px;
}
#caption {
  text-align: center;
  margin-top: 6px;
}
.work-link {
  padding: 2px 0;
  background: transparent;
  color: #2563eb;
  text-align: left;
  overflow-wrap: anywhere;
}
.table-scroll {
  overflow-x: auto;
}
#tasks td {
  text-align: left;
  vertical-align: top;
  padding: 10px 6px;
  overflow-wrap: anywhere;
}
#tasks td:first-child {
  max-width: 240px;
}
#tasks td:last-child {
  min-width: 72px;
}
.row2 {
  align-items: stretch;
}
#serviceStatusCard {
  display: flex;
  flex-direction: column;
  flex: 1;
}
#serviceStatusCard .status-tasks {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
#serviceStatusCard .table-scroll {
  flex: 0 0 auto;
  height: 360px;
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
}
#serviceStatusCard .table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
}
@media (max-width: 600px) {
  #serviceStatusCard .table-scroll {
    height: 280px;
  }
}
#serviceStatusCard .pager {
  margin-top: auto;
  padding-top: 12px;
}
.service-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.service-status-row p {
  margin: 0;
  min-width: 0;
}
.service-status-row button {
  flex-shrink: 0;
}
.status-tasks {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.status-stack,
.collection-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.dataset-card .src-bar {
  flex-wrap: wrap;
}
.dataset-card .doc-select {
  flex-basis: 100%;
}
.main,
.side,
.card {
  min-width: 0;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}
@media (max-width: 600px) {
  body {
    padding: 8px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .src-bar,
  .tools {
    flex-wrap: wrap;
  }
  .title b {
    font-size: 16px;
  }
}
.live-number {
  font-variant-numeric: tabular-nums;
  color: #2563eb;
  font-weight: 600;
}
/* 排行榜高度独立于主栏，列表在卡片内滚动。 */
.side > .card:last-child {
  flex: 0 0 auto;
}
.ranking-scroll,
.tag-list {
  height: 360px;
  max-height: 360px;
  overflow: auto;
  direction: ltr;
  scrollbar-gutter: stable;
}
.ranking-scroll thead th,
.tag-list thead th {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.rank-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.rank-controls select {
  width: 100%;
  min-width: 0;
}
.ranking-scroll td {
  vertical-align: top;
}
.ranking-scroll td:last-child {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.selected-work {
  background: #eaf2ff;
}
.artwork-details {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 8px;
  font-size: 12px;
  margin: 0 0 16px;
}
.artwork-details dt {
  color: var(--muted);
}
.artwork-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.original-urls {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-bottom: 14px;
  font-size: 12px;
}
.original-urls h3 {
  font-size: 13px;
  margin: 0 0 8px;
}
.original-urls ol {
  max-height: 180px;
  overflow: auto;
  padding-left: 22px;
  margin: 0;
}
.original-urls li {
  padding: 4px;
  overflow-wrap: anywhere;
}
.artwork-details a,
.original-urls a {
  color: var(--accent);
}
@media (max-width: 600px) {
  .ranking-scroll,
  .tag-list {
    height: 280px;
    max-height: 280px;
  }
}
/* 排行分页、标签总数与横向采集标签栏 */
.tag-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.tag-heading h2 {
  margin: 0;
  text-align: left;
}
#tagTotal {
  white-space: nowrap;
}
.tag-list .rank-table {
  table-layout: fixed;
}
.tag-list .rank-table th:nth-child(2),
.tag-list .rank-table td:nth-child(2),
.tag-list .rank-table th:nth-child(3),
.tag-list .rank-table td:nth-child(3) {
  width: 72px;
  text-align: center;
  white-space: nowrap;
  padding-left: 8px;
  padding-right: 8px;
}
.tag-list .rank-table td:first-child {
  overflow-wrap: anywhere;
}
#artPage {
  white-space: nowrap;
  text-align: center;
  flex: 1;
}
.dataset-carousel {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  min-width: 0;
}
.dataset-carousel > button {
  padding: 3px 8px;
  flex-shrink: 0;
  font-size: 20px;
}
.dataset-track {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  padding: 3px 0 6px;
  touch-action: pan-x pan-y;
}
.dataset-chip {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
  padding: 3px 10px;
  white-space: nowrap;
  scroll-snap-align: start;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dataset-chip[aria-pressed="true"] {
  background: #e0edff;
  color: #1d4ed8;
  font-weight: 600;
}
.task-operation {
  display: inline-flex;
  align-items: stretch;
  white-space: nowrap;
}
.task-operation > button {
  border-radius: 6px 0 0 6px;
}
.task-operation select {
  width: 32px;
  padding: 0;
  color: transparent;
  appearance: none;
  background-color: #eef2ff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23334155' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
}
.task-operation select option {
  color: #334155;
}
.page-jump {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 12px;
}
.page-jump label {
  margin: 0;
}
.page-jump input {
  width: 52px;
  padding: 4px;
  text-align: center;
}
.page-jump button {
  padding: 4px 6px;
}
.artwork-id-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  max-width: 100%;
  font-size: 18px;
  font-weight: 600;
}
.artwork-id-picker select {
  width: auto;
  min-width: 150px;
  max-width: 100%;
  font-size: 18px;
}
.service-summary {display:flex;align-items:center;gap:8px 20px;flex-wrap:wrap}
.task-tags {color:#2563eb;overflow-wrap:anywhere}
.task-time {display:inline-block;font-size:12px}
.image-dialog {border:1px solid #cbd5e1;border-radius:12px;padding:24px;max-width:calc(100vw - 32px)}
.image-tools {display:flex;align-items:center;flex-wrap:wrap;gap:10px;padding:12px}
.image-viewer {width:94vw;height:92vh;max-width:94vw;max-height:92vh;padding:0;border:0;border-radius:12px;background:#172033;color:white}
.image-viewer[open] {display:flex;flex-direction:column}
.image-viewer::backdrop,.image-dialog::backdrop {background:rgb(0 0 0 / 65%)}
.image-stage {position:relative;display:flex;align-items:center;justify-content:center;flex:1;min-height:0;overflow:hidden;touch-action:none;cursor:grab}
.image-stage:active {cursor:grabbing}
.image-stage img {max-width:100%;max-height:100%;object-fit:contain;user-select:none;flex-shrink:0;transform-origin:center}
#preview {cursor:zoom-in}
