:root {
  color-scheme: dark;
  --bg: #0b101a;
  --panel: #131b29;
  --panel-soft: #172234;
  --panel-strong: #1d2b42;
  --line: #2a3850;
  --line-soft: rgba(125, 168, 220, 0.18);
  --text: #edf5ff;
  --muted: #96a9c2;
  --blue: #2f9cff;
  --blue-strong: #55b6ff;
  --cyan: #34d4c4;
  --purple: #9c5dff;
  --green: #52d99b;
  --red: #ff7a8a;
  --yellow: #ffd75c;
  --shadow: 0 18px 54px rgba(0, 0, 0, 0.28);
  --radius: 8px;
  --table-row-height: 72px;
  --table-head-height: 48px;
  --table-visible-rows: 20;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background:
    radial-gradient(circle at 14% -14%, rgba(47, 156, 255, 0.22), transparent 34vw),
    radial-gradient(circle at 75% -8%, rgba(52, 212, 196, 0.16), transparent 28vw),
    linear-gradient(180deg, #101929 0%, var(--bg) 420px);
  font-family: Inter, "Segoe UI", Arial, "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

body.modal-open {
  overflow: hidden;
}

* {
  scrollbar-color: #4a5d78 #0e1624;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: #0e1624;
}

*::-webkit-scrollbar-thumb {
  background: #4a5d78;
  border: 2px solid #0e1624;
  border-radius: 999px;
}

a {
  color: var(--blue-strong);
}

button,
input,
select {
  font: inherit;
}

button,
select,
input {
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

button {
  color: var(--text);
  background: linear-gradient(180deg, #263650, #19263a);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

button:hover {
  border-color: rgba(85, 182, 255, 0.72);
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

input,
select {
  color: var(--text);
  background: rgba(10, 16, 27, 0.84);
  min-width: 0;
}

input::placeholder {
  color: #71849d;
}

select {
  appearance: none;
  width: 100%;
  padding: 12px 36px 12px 14px;
  background-image:
    linear-gradient(45deg, transparent 50%, #95a8c2 50%),
    linear-gradient(135deg, #95a8c2 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}

h1,
h2,
p {
  margin: 0;
}

.app-shell {
  position: relative;
  min-height: 100vh;
}

.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.82), transparent 78%);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 26px 12px;
  border-bottom: 1px solid var(--line-soft);
  background:
    linear-gradient(90deg, rgba(11, 16, 26, 0.96), rgba(17, 26, 42, 0.86)),
    linear-gradient(135deg, rgba(47, 156, 255, 0.16), transparent 48%);
  backdrop-filter: blur(16px);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.24);
}

.app-header-main {
  display: flex;
  align-items: center;
  gap: 28px;
  min-width: 0;
}

.app-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(7, 13, 23, 0.68);
}

.app-tab {
  min-height: 34px;
  padding: 7px 14px;
  border-color: transparent;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
  white-space: nowrap;
}

.app-tab[aria-pressed="true"] {
  color: #f8fbff;
  border-color: rgba(85, 182, 255, 0.48);
  background: linear-gradient(180deg, rgba(47, 156, 255, 0.42), rgba(18, 85, 142, 0.52));
  box-shadow: 0 10px 24px rgba(47, 156, 255, 0.18);
}

.eyebrow {
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7dd3fc;
}

.app-header h1 {
  font-size: 25px;
  line-height: 1.15;
  letter-spacing: 0;
}

.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border-color: rgba(85, 182, 255, 0.34);
  background: linear-gradient(180deg, #2b3b56, #1b2a41);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.layout {
  padding: 18px 26px 28px;
}

.page-section[hidden] {
  display: none;
}

.query-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(300px, 1.1fr) minmax(380px, 1.65fr) minmax(210px, 0.8fr);
  gap: 16px;
  align-items: stretch;
  margin-bottom: 38px;
}

.query-card,
.results-section,
.task-card,
.selection-help-panel,
.detail-panel {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), transparent 160px),
    rgba(19, 27, 41, 0.94);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.query-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 142px;
  padding: 14px;
}

.task-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(480px, 1.4fr);
  gap: 16px;
  align-items: start;
}

.task-card {
  min-width: 0;
  padding: 18px;
}

.task-items-card,
.task-history-card {
  grid-column: 1 / -1;
}

.task-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.task-card-head h2 {
  font-size: 18px;
}

.task-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.task-settings-grid label {
  display: grid;
  gap: 7px;
}

.task-settings-grid label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.task-settings-grid input,
.task-settings-grid select {
  min-height: 38px;
  padding: 9px 12px;
}

.task-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.full-collect-panel {
  background:
    linear-gradient(135deg, rgba(47, 156, 255, 0.12), transparent 38%),
    linear-gradient(180deg, rgba(24, 35, 54, 0.96), rgba(14, 21, 33, 0.96));
}

.full-collect-head,
.full-collect-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.full-collect-head {
  justify-content: space-between;
  margin-bottom: 14px;
}

.full-collect-head h2 {
  font-size: 18px;
}

.job-status {
  min-width: 72px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  text-align: center;
  background: rgba(10, 16, 27, 0.72);
}

.job-status.mini {
  min-width: 0;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.job-status.running,
.job-status.pausing {
  color: var(--cyan);
  border-color: rgba(52, 212, 196, 0.42);
}

.job-status.success {
  color: var(--green);
  border-color: rgba(82, 217, 155, 0.42);
}

.job-status.failed,
.job-status.partial,
.job-status.cancelled {
  color: var(--red);
  border-color: rgba(255, 122, 138, 0.42);
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid rgba(125, 168, 220, 0.16);
  background: rgba(6, 12, 22, 0.9);
}

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  transition: width 220ms ease;
}

.full-collect-grid {
  display: grid;
  grid-template-columns: 160px minmax(260px, 1fr) 160px 140px;
  gap: 12px;
  margin-top: 14px;
}

.full-collect-grid > div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(125, 168, 220, 0.14);
  border-radius: var(--radius);
  background: rgba(6, 12, 22, 0.34);
}

.metric-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.full-collect-grid strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.full-collect-actions {
  flex-wrap: wrap;
  margin-top: 14px;
}

.pill-button.danger {
  border-color: rgba(255, 122, 138, 0.42);
  color: #ffb6bf;
}

.full-collect-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.job-item-chip {
  max-width: 360px;
  padding: 6px 9px;
  overflow: hidden;
  border: 1px solid rgba(125, 168, 220, 0.18);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(6, 12, 22, 0.42);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.job-item-chip.running {
  color: var(--cyan);
}

.job-item-chip.failed {
  color: var(--red);
}

.job-item-chip.success {
  color: var(--green);
}

.task-filter-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.task-filter-tabs button {
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  color: #9fc8f4;
  background: rgba(15, 28, 45, 0.9);
  white-space: nowrap;
}

.task-filter-tabs button[aria-pressed="true"] {
  color: #fff;
  border-color: var(--cyan);
  background: linear-gradient(180deg, rgba(45, 178, 212, 0.32), rgba(31, 102, 157, 0.48));
}

.job-table-wrap {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #101827;
}

.job-table-wrap.compact {
  max-height: 320px;
}

.job-table {
  min-width: 980px;
}

.job-table tbody tr {
  height: 48px;
  cursor: default;
}

.job-table tbody td {
  height: 48px;
  padding: 8px 12px;
}

.job-table th:nth-child(1),
.job-table td:nth-child(1) {
  width: 82px;
  text-align: center;
}

.job-table th:nth-child(2),
.job-table td:nth-child(2) {
  width: 360px;
}

.job-table th:nth-child(3),
.job-table td:nth-child(3) {
  width: 120px;
}

.job-table th:nth-child(4),
.job-table td:nth-child(4),
.job-table th:nth-child(5),
.job-table td:nth-child(5) {
  width: 110px;
  text-align: center;
}

.job-path-cell,
.job-error-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-title {
  font-size: 13px;
  font-weight: 800;
  color: #dbeafe;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #101827;
}

.segmented.slim {
  grid-template-columns: repeat(2, 1fr);
  width: 100%;
}

.segmented.three {
  grid-template-columns: repeat(3, 1fr);
}

.segmented.four {
  grid-template-columns: repeat(4, 1fr);
}

.segment-button {
  min-height: 38px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segment-button[aria-pressed="true"] {
  color: #fff;
  background: linear-gradient(180deg, #35aaff, #1d8ff0);
  box-shadow: 0 10px 26px rgba(47, 156, 255, 0.32);
}

.select-shell,
.catalog-level-shell {
  display: grid;
  gap: 7px;
}

.select-shell span,
.catalog-level-shell span,
.setting-row > span,
.mini-meta,
.count-pill,
.detail-label,
.muted {
  color: var(--muted);
  font-size: 12px;
}

.category-path-panel span {
  color: #76e29f;
  font-weight: 700;
}

.catalog-level-selectors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.catalog-level-shell select {
  min-height: 38px;
  padding-top: 9px;
  padding-bottom: 9px;
}

.catalog-search-wrap {
  display: grid;
  gap: 8px;
}

.catalog-search-select {
  min-height: 38px;
}

.category-path-panel {
  min-height: 38px;
  display: grid;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(82, 217, 155, 0.24);
  border-radius: var(--radius);
  background: rgba(9, 22, 34, 0.66);
}

.collect-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px;
  gap: 8px;
}

.collect-input,
.search-input,
.catalog-search-input {
  min-height: 38px;
  padding: 9px 12px;
}

.catalog-search-input {
  width: 100%;
}

.collect-form button {
  padding: 8px 10px;
}

.settings-card {
  gap: 10px;
}

.setting-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.action-card {
  align-content: center;
}

.primary-button {
  min-height: 46px;
  padding: 10px 16px;
  border-color: rgba(85, 182, 255, 0.55);
  background: linear-gradient(180deg, #35aaff, #1d8ff0);
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(47, 156, 255, 0.28);
}

.results-section {
  padding: 0 16px 16px;
  overflow: visible;
}

.results-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 0 12px;
  margin: 0 0 0;
  background: transparent;
}

.results-head h2 {
  font-size: 24px;
  line-height: 1.1;
}

.results-title-block {
  flex: 0 0 auto;
}

.results-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.results-help-button {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 26px;
  padding: 0;
  border: 1px solid rgba(85, 182, 255, 0.5);
  border-radius: 999px;
  background: rgba(47, 156, 255, 0.12);
  color: #8fd7ff;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.results-help-button:hover,
.results-help-button:focus-visible {
  border-color: #60c7ff;
  background: rgba(47, 156, 255, 0.24);
  color: #ffffff;
}

.title-line {
  width: 64px;
  height: 3px;
  margin-top: 9px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  box-shadow: 0 0 18px rgba(52, 212, 196, 0.24);
}

.results-actions {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.pill-button,
.count-pill {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

.pill-button.blue {
  border-color: rgba(47, 156, 255, 0.55);
  background: linear-gradient(180deg, #1ca3ff, #0a7fd4);
  box-shadow: 0 14px 28px rgba(47, 156, 255, 0.24);
}

.pill-button.blue::before {
  content: "🔗";
}

.pill-button.purple {
  border-color: rgba(156, 93, 255, 0.55);
  background: linear-gradient(180deg, #b26bff, #7d3df2);
  box-shadow: 0 14px 28px rgba(156, 93, 255, 0.24);
}

.pill-button.purple::before {
  content: "▣";
}

.pill-button.ghost {
  background: #121b2b;
  color: #c8d8ed;
}

.count-pill {
  border: 1px solid var(--line-soft);
  background: rgba(12, 18, 30, 0.82);
}

.bridge-status {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: #aebfd5;
  background: rgba(12, 18, 30, 0.82);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.bridge-status.is-connected {
  color: #b9fff0;
  border-color: rgba(52, 212, 196, 0.5);
  background: rgba(20, 83, 78, 0.38);
}

.bridge-status.is-missing {
  color: #ffd2a8;
  border-color: rgba(251, 146, 60, 0.48);
  background: rgba(124, 45, 18, 0.34);
}

.bridge-status.is-reload {
  color: #fff1a6;
  border-color: rgba(250, 204, 21, 0.52);
  background: rgba(113, 63, 18, 0.38);
}

.quick-transfer {
  position: relative;
}

.quick-transfer-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  z-index: 5;
  min-width: 150px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(19, 27, 41, 0.98);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  transform: translateX(-50%);
}

.quick-transfer-menu a,
.menu-empty {
  display: block;
  padding: 10px 12px;
  border-radius: 6px;
  color: #9bdcff;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.quick-transfer-menu a:hover {
  background: rgba(47, 156, 255, 0.13);
}

.filter-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(11, 17, 28, 0.72);
}

.factory-keyword-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding-top: 2px;
}

.store-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.filter-label {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 800;
  color: #d7e7ff;
}

.store-filter-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.factory-keyword-links {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.store-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  color: #89cffb;
  background: rgba(23, 44, 66, 0.92);
  border-color: rgba(80, 180, 225, 0.58);
  white-space: nowrap;
}

.store-chip span {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(47, 156, 255, 0.18);
  color: #dff6ff;
  font-size: 12px;
}

.store-chip[aria-pressed="true"] {
  color: #fff;
  border-color: var(--cyan);
  background: linear-gradient(180deg, rgba(45, 178, 212, 0.32), rgba(31, 102, 157, 0.48));
  box-shadow: 0 0 0 1px rgba(52, 212, 196, 0.12), 0 0 20px rgba(52, 212, 196, 0.12);
}

.factory-keyword-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 12px;
  border: 1px solid rgba(85, 182, 255, 0.5);
  border-radius: 999px;
  color: #dff6ff;
  background: rgba(15, 32, 52, 0.9);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.factory-keyword-link:hover {
  border-color: var(--cyan);
  background: rgba(28, 75, 92, 0.86);
}

.factory-keyword-link span {
  color: #92abc8;
  font-size: 12px;
  font-weight: 700;
}

.factory-keyword-picker {
  position: relative;
  display: inline-flex;
}

.factory-keyword-picker .factory-keyword-link {
  font: inherit;
}

.factory-keyword-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 8;
  display: grid;
  min-width: 150px;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(17, 25, 39, 0.98);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

.factory-keyword-menu a,
.factory-keyword-menu button {
  display: block;
  width: 100%;
  min-height: 30px;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #9bdcff;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.factory-keyword-menu a:hover,
.factory-keyword-menu button:hover {
  background: rgba(47, 156, 255, 0.13);
}

.inline-empty {
  color: var(--muted);
  font-size: 12px;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px;
  gap: 8px;
}

.search-row button {
  padding: 8px 10px;
}

.table-wrap {
  height: calc(var(--table-head-height) + var(--table-row-height) * var(--table-visible-rows));
  min-height: min(calc(var(--table-head-height) + var(--table-row-height) * 12), calc(100vh - 260px));
  max-height: calc(var(--table-head-height) + var(--table-row-height) * var(--table-visible-rows));
  margin-top: 14px;
  overflow: auto;
  border-top: 1px solid var(--line-soft);
  border-radius: 0 0 var(--radius) var(--radius);
  background:
    linear-gradient(180deg, rgba(47, 156, 255, 0.045), transparent 160px),
    #101827;
}

table {
  width: 100%;
  min-width: 1590px;
  border-collapse: collapse;
  table-layout: fixed;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: var(--table-head-height);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #192438, #101827);
  color: #c4d3e8;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}

tbody tr {
  height: var(--table-row-height);
  cursor: pointer;
}

tbody tr:hover,
tbody tr[aria-selected="true"] {
  background:
    linear-gradient(90deg, rgba(47, 156, 255, 0.12), transparent 58%),
    rgba(28, 42, 62, 0.72);
}

tbody td {
  height: var(--table-row-height);
  padding: 8px 12px;
  border-bottom: 1px solid rgba(42, 56, 80, 0.72);
  vertical-align: middle;
}

thead th:nth-child(1),
.rank-cell {
  width: 64px;
  text-align: center;
}

thead th:nth-child(2),
.store-cell {
  width: 160px;
}

thead th:nth-child(3),
.product-info-cell {
  width: 350px;
}

thead th:nth-child(4),
thead th:nth-child(5),
thead th:nth-child(6),
thead th:nth-child(7),
thead th:nth-child(8),
thead th:nth-child(9),
thead th:nth-child(10),
thead th:nth-child(11),
.metric-cell,
.amount-cell {
  width: 110px;
  text-align: center;
}

thead th:nth-child(12),
.action-cell {
  width: 116px;
  text-align: center;
}

.rank-badge {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #8ad4ff;
  font-weight: 900;
}

.top-rank {
  color: #1b2332;
  background: #f2f5fa;
}

.rank-1 {
  background: #ffe13d;
}

.rank-2 {
  background: #d9dee7;
}

.rank-3 {
  background: #d99a1d;
}

.store-cell {
  text-align: left;
}

.shop-link {
  display: -webkit-box;
  margin-top: 8px;
  max-width: 142px;
  overflow: hidden;
  color: #9bdcff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
  word-break: break-word;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.shop-link:hover {
  color: #dff6ff;
  text-decoration: underline;
}

.shop-link.disabled {
  color: var(--muted);
  text-decoration: none;
}

.product-info-cell {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.product-thumb {
  width: 52px;
  height: 52px;
  padding: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0d1421;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
  cursor: zoom-in;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.product-copy strong,
.product-title-link {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-title-link {
  color: #f2f8ff;
  font-weight: 800;
  text-decoration: none;
}

.product-title-link:hover {
  color: var(--cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.product-copy span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.placeholder {
  color: #70849f;
}

.action-stack {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 0;
}

.detail-button {
  min-width: 74px;
  min-height: 30px;
  padding: 5px 12px;
  color: #a9ddff;
  border-color: rgba(85, 182, 255, 0.64);
  background: rgba(15, 28, 45, 0.92);
  font-weight: 800;
}

.product-id-text {
  display: block;
  width: 132px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-badge {
  position: relative;
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  cursor: help;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.48),
    0 0 14px rgba(47, 156, 255, 0.12);
}

.source-badge::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 5;
  width: max-content;
  max-width: 180px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #edf4ff;
  color: #0f1724;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 3px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.source-badge::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 3px);
  z-index: 5;
  border: 5px solid transparent;
  border-top: 0;
  border-bottom-color: #edf4ff;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 3px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.source-badge:hover::after,
.source-badge:hover::before {
  opacity: 1;
  transform: translate(-50%, 0);
}

.source-taobao {
  color: #fff;
  background: linear-gradient(180deg, #ff8a33, #f15a00);
  border-color: #f97316;
}

.source-tmall {
  color: #fff;
  background: linear-gradient(180deg, #ff4d42, #c91605);
  border-color: #ef4444;
}

.source-factory-1,
.source-factory-2,
.source-factory-3,
.source-factory-guohuo,
.source-factory-guohuo-2,
.source-factory-guohuo-3 {
  color: #fff;
  background: linear-gradient(180deg, #16a394, #0f766e);
  border-color: #14b8a6;
}

.source-factory-guohuo,
.source-factory-guohuo-2,
.source-factory-guohuo-3 {
  background: linear-gradient(180deg, #4f8cff, #2563eb);
  border-color: #60a5fa;
}

.source-unknown {
  color: var(--muted);
  background: #0f1724;
}

.sales-metric {
  color: #d6f4ff;
  font-weight: 800;
}

.daily-sales-metric .metric-stack strong {
  color: #8ce8c1;
}

.metric-stack {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-width: 0;
  color: #dce9f8;
  line-height: 1.15;
}

.metric-stack strong {
  max-width: 100%;
  overflow: hidden;
  color: #edf7ff;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-stack small,
.selection-score small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-stack.is-positive strong {
  color: #63e6b5;
}

.metric-stack.is-negative strong {
  color: #ff9b8f;
}

.metric-stack.is-neutral strong {
  color: #ffd66b;
}

.metric-unavailable {
  color: #6f839f;
  font-size: 12px;
  cursor: help;
}

.metric-badge {
  display: inline-flex;
  min-height: 26px;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  overflow: hidden;
  border: 1px solid rgba(126, 151, 181, 0.35);
  border-radius: 6px;
  color: #c9d7e8;
  background: rgba(24, 36, 54, 0.86);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-type.store-factory {
  color: #8df0c8;
  border-color: rgba(54, 211, 153, 0.5);
  background: rgba(9, 91, 68, 0.34);
}

.store-type.store-tmall {
  color: #ffb4ad;
  border-color: rgba(248, 102, 91, 0.52);
  background: rgba(116, 35, 30, 0.34);
}

.store-type.store-taobao {
  color: #ffd092;
  border-color: rgba(249, 145, 54, 0.52);
  background: rgba(116, 66, 20, 0.34);
}

.store-type.store-other {
  color: #9aacbf;
  border-color: rgba(126, 151, 181, 0.3);
  background: rgba(21, 31, 46, 0.72);
}

.selection-score {
  width: 66px;
  min-height: 52px;
  display: inline-grid;
  place-content: center;
  gap: 2px;
  border: 1px solid rgba(51, 186, 255, 0.52);
  border-radius: 8px;
  background: rgba(20, 61, 89, 0.5);
  cursor: help;
}

.selection-score strong {
  color: #91e6ff;
  font-size: 22px;
  line-height: 1;
}

.selection-score.score-medium {
  border-color: rgba(245, 190, 48, 0.48);
  background: rgba(92, 68, 14, 0.34);
}

.selection-score.score-low {
  border-color: rgba(239, 112, 93, 0.42);
  background: rgba(88, 39, 36, 0.32);
}

.selection-score.score-medium strong {
  color: #ffe084;
}

.selection-score.score-low strong {
  color: #ffb0a4;
}

.empty-state {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.selection-help-modal[hidden] {
  display: none;
}

.selection-help-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
}

.selection-help-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 15, 0.68);
  backdrop-filter: blur(5px);
}

.selection-help-panel {
  position: relative;
  width: min(1040px, calc(100vw - 32px));
  height: min(860px, calc(100vh - 32px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.selection-help-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(31, 44, 66, 0.96), rgba(21, 29, 43, 0.9));
}

.selection-help-head h2 {
  font-size: 20px;
  line-height: 1.2;
}

.selection-help-head p:last-child {
  max-width: 680px;
  margin-top: 5px;
  color: var(--muted);
}

.selection-help-head .icon-button {
  flex: 0 0 40px;
  font-size: 26px;
  line-height: 1;
}

.selection-help-body {
  padding: 20px;
  overflow: auto;
  overscroll-behavior: contain;
}

.selection-help-notice {
  padding: 2px 0 2px 14px;
  border-left: 3px solid var(--cyan);
}

.selection-help-notice strong {
  color: #e9f7ff;
  font-size: 15px;
}

.selection-help-notice p {
  margin-top: 5px;
  color: #b8c8dc;
}

.selection-help-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 28px;
  margin-top: 22px;
  border-bottom: 1px solid var(--line-soft);
}

.selection-help-metric {
  min-width: 0;
  padding: 16px 0 18px;
  border-top: 1px solid var(--line-soft);
}

.selection-help-metric h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 8px;
  color: #f0f7ff;
  font-size: 16px;
}

.selection-help-metric h3 span {
  color: #62c9ff;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.selection-help-metric p {
  margin: 0;
  color: #b5c5d9;
  line-height: 1.65;
}

.selection-help-metric p + p {
  margin-top: 7px;
}

.selection-help-metric b {
  color: #f5d06f;
}

.selection-help-use strong {
  margin-right: 5px;
  color: #74dfc8;
}

.selection-help-section {
  padding-top: 24px;
}

.selection-help-section + .selection-help-section {
  margin-top: 24px;
  border-top: 1px solid var(--line-soft);
}

.selection-help-section-head {
  margin-bottom: 12px;
}

.selection-help-section-head span {
  color: #6fcfff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.selection-help-section-head h3 {
  margin-top: 4px;
  color: #edf6ff;
  font-size: 17px;
}

.selection-help-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.selection-help-table {
  min-width: 680px;
  table-layout: auto;
}

.selection-help-table thead th {
  position: static;
  width: auto;
  height: auto;
  padding: 10px 12px;
  text-align: left;
}

.selection-help-table tbody tr {
  height: auto;
  cursor: default;
}

.selection-help-table tbody tr:hover {
  background: transparent;
}

.selection-help-table tbody td {
  width: auto;
  height: auto;
  padding: 10px 12px;
  color: #b9c9dc;
  text-align: left;
  vertical-align: top;
}

.selection-help-table tbody td:nth-child(1),
.selection-help-table tbody td:nth-child(2) {
  color: #edf6ff;
  font-weight: 800;
}

.selection-help-steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 24px;
  color: #b9c9dc;
}

.selection-help-steps li {
  padding-left: 4px;
  line-height: 1.6;
}

.selection-help-steps li::marker {
  color: #5fcaff;
  font-weight: 900;
}

.selection-help-steps strong {
  color: #edf6ff;
}

.selection-help-conclusion {
  margin: 24px 0 0;
  padding: 14px 16px;
  border: 1px solid rgba(52, 212, 196, 0.3);
  border-radius: var(--radius);
  background: rgba(52, 212, 196, 0.07);
  color: #bff6e9;
  font-weight: 800;
  line-height: 1.6;
}

.detail-modal[hidden] {
  display: none;
}

.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  justify-items: end;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 15, 0.58);
  backdrop-filter: blur(4px);
}

.detail-panel {
  position: relative;
  width: min(520px, calc(100vw - 28px));
  height: calc(100vh - 28px);
  margin: 14px;
  overflow: hidden;
}

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(31, 44, 66, 0.92), rgba(21, 29, 43, 0.78));
}

.detail-head h2 {
  font-size: 18px;
}

.detail-head .icon-button {
  font-size: 26px;
  line-height: 1;
}

.detail-body {
  height: calc(100% - 74px);
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 16px;
  overflow: auto;
}

.detail-image {
  width: 116px;
  height: 116px;
  padding: 0;
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f1724;
  cursor: zoom-in;
}

.detail-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-preview-modal[hidden] {
  display: none;
}

.image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
}

.image-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 12, 0.88);
  backdrop-filter: blur(6px);
}

.image-preview-panel {
  position: relative;
  width: min(1200px, calc(100vw - 48px));
  height: calc(100vh - 48px);
  display: grid;
  place-items: center;
  outline: none;
}

.image-preview-image {
  display: block;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  background: #ffffff;
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.48);
}

.image-preview-close {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1;
  width: 44px;
  height: 44px;
  font-size: 28px;
  line-height: 1;
  background: rgba(20, 31, 47, 0.94);
}

.detail-kv {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 9px 12px;
  margin: 0;
}

.detail-kv dt {
  color: var(--muted);
}

.detail-kv dd {
  margin: 0;
  word-break: break-word;
}

.factory-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.factory-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid #3979bd;
  border-radius: var(--radius);
  background: rgba(47, 156, 255, 0.12);
  color: #9bdcff;
  text-decoration: none;
}

.factory-page {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.factory-page-head,
.factory-status-panel,
.factory-category-results {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(16, 24, 38, 0.93), rgba(9, 14, 24, 0.93)),
    rgba(9, 14, 24, 0.9);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}

.factory-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
}

.factory-page-head h1 {
  margin: 4px 0 6px;
  font-size: 24px;
  letter-spacing: 0;
}

.factory-page-meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.factory-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.factory-status-panel {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
}

.factory-load-status {
  display: grid;
  place-items: center;
  min-height: 76px;
  padding: 12px;
  border: 1px solid rgba(52, 212, 196, 0.24);
  border-radius: 8px;
  background: rgba(20, 184, 166, 0.08);
  color: #c7fff7;
  font-weight: 800;
  text-align: center;
}

.factory-load-status.is-error {
  border-color: rgba(248, 113, 113, 0.42);
  background: rgba(248, 113, 113, 0.1);
  color: #fecaca;
}

.factory-request-preview {
  min-height: 76px;
  max-height: 150px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.55);
  color: #bde9ff;
  font-size: 12px;
}

.factory-category-results {
  margin-top: 14px;
  padding: 14px;
}

.factory-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.factory-result-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.factory-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.factory-product-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, 0.16);
  border-radius: 8px;
  background: rgba(8, 13, 23, 0.72);
}

.factory-product-image {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: rgba(2, 6, 23, 0.82);
  color: var(--muted);
  text-decoration: none;
}

.factory-product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.18s ease;
}

.factory-product-card:hover .factory-product-image img {
  transform: scale(1.035);
}

.factory-product-body {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.factory-product-rank {
  width: max-content;
  padding: 2px 8px;
  border-radius: 999px;
  color: #06111d;
  background: var(--cyan);
  font-size: 12px;
  font-weight: 900;
}

.factory-product-title {
  min-height: 42px;
  color: #ecfeff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
  text-decoration: none;
}

.factory-product-title:hover {
  color: #7dd3fc;
}

.factory-product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: #9fb4d0;
  font-size: 12px;
}

.factory-product-meta span {
  padding: 3px 7px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
}

.factory-empty {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px dashed rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.factory-load-more-row {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

@media (max-width: 720px) {
  .factory-page {
    padding: 12px;
  }

  .factory-page-head,
  .factory-status-panel {
    grid-template-columns: 1fr;
  }

  .factory-page-head {
    display: grid;
  }

  .factory-page-actions {
    justify-content: flex-start;
  }
}

pre {
  margin: 0;
  padding: 12px;
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid #213049;
  background: #070b12;
  color: #dbeafe;
  font-size: 12px;
  line-height: 1.5;
}

.boot-error {
  margin: 24px;
  padding: 16px;
  color: #ffd6dc;
  border-color: rgba(255, 122, 138, 0.5);
  background: rgba(78, 22, 32, 0.82);
}

@media (max-width: 1360px) {
  .query-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-band {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .app-header,
  .layout {
    padding-left: 14px;
    padding-right: 14px;
  }

  .query-grid {
    grid-template-columns: 1fr;
    margin-bottom: 24px;
  }

  .results-head {
    align-items: stretch;
    flex-direction: column;
  }

  .results-actions {
    justify-content: flex-start;
  }

  .selection-help-panel {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
  }

  .selection-help-head {
    gap: 12px;
    padding: 14px 16px;
  }

  .selection-help-head h2 {
    font-size: 18px;
  }

  .selection-help-body {
    padding: 16px;
  }

  .selection-help-metrics {
    grid-template-columns: 1fr;
  }

  .image-preview-modal {
    padding: 12px;
  }

  .image-preview-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
  }

  .image-preview-image {
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }

  .image-preview-close {
    top: 12px;
    right: 12px;
  }

  .store-filter-row {
    align-items: stretch;
    flex-direction: column;
  }

  .factory-keyword-row {
    align-items: stretch;
    flex-direction: column;
  }

  .setting-row,
  .collect-form,
  .search-row,
  .catalog-level-selectors {
    grid-template-columns: 1fr;
  }
}
