:root {
  color-scheme: light;
  --ink: #1b2321;
  --muted: #63706c;
  --line: #d9dfdc;
  --line-strong: #b7c2bd;
  --surface: #ffffff;
  --surface-soft: #f5f7f6;
  --surface-warm: #f8f3e8;
  --green: #08745c;
  --green-soft: #e6f2ee;
  --amber: #9a5b05;
  --amber-soft: #fff1d7;
  --red: #b4362c;
  --red-soft: #fce9e7;
  --blue: #245c85;
  --blue-soft: #e7eff7;
  --shadow: 0 8px 24px rgba(26, 38, 34, 0.09);
}

.learning-upload-grid,
.learning-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.learning-upload-grid { margin: 16px 0; }
.learning-upload-panel .button { margin-top: 4px; }
.upload-choice { display: grid; gap: 7px; padding: 14px; border: 1px dashed var(--line-strong); background: var(--surface-soft); border-radius: 6px; }
.upload-choice input { max-width: 100%; }
.upload-choice small, .learning-upload-panel p, .learning-privacy span, .learning-batch-row small, .learning-file-row small, .knowledge-row small { color: var(--muted); display: block; line-height: 1.5; }
.learning-privacy { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; padding: 10px 12px; border-left: 3px solid var(--blue); background: var(--blue-soft); }
.learning-result-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.learning-result-strip > div { padding: 12px 14px; border-right: 1px solid var(--line); }
.learning-result-strip > div:last-child { border-right: 0; }
.learning-result-strip strong, .learning-result-strip span { display: block; }
.learning-result-strip strong { font-size: 20px; }
.learning-result-strip span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.learning-file-list { max-height: 320px; overflow: auto; padding: 0 14px; }
.learning-file-row, .learning-batch-row, .knowledge-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.learning-file-row:last-child, .learning-batch-row:last-child, .knowledge-row:last-child { border-bottom: 0; }
.learning-file-row > div, .learning-batch-row > div, .knowledge-row > div:first-child { min-width: 0; flex: 1; }
.learning-file-row strong, .learning-batch-title strong { display: block; overflow-wrap: anywhere; }
.learning-file-row small, .learning-batch-row small, .knowledge-row small { overflow-wrap: anywhere; }
.learning-file-more { padding: 11px 0; color: var(--muted); text-align: center; }
.learning-batch-title { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.learning-batch-title strong { min-width: 0; }
.learning-warning { margin-top: 5px; color: var(--amber) !important; }
.learning-error { margin-top: 5px; color: var(--red) !important; }
.learning-profile-summary { display: grid; gap: 5px; padding: 14px; background: var(--surface-soft); border-radius: 5px; margin-bottom: 12px; }
.learning-profile-summary span { color: var(--muted); line-height: 1.5; }
.knowledge-row > div:last-child { flex: 0 0 auto; }
.term-input-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.term-input-row .input, .term-input-row .textarea { flex: 1 1 240px; }
.term-list { display: flex; flex-wrap: wrap; gap: 7px; }
.term-chip { display: inline-flex; gap: 5px; align-items: center; padding: 4px 8px; border: 1px solid var(--line-strong); background: var(--surface-soft); border-radius: 999px; font-size: 12px; }
.term-chip.disabled { opacity: .55; }
.term-chip button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 2px; }
.generation-modal { max-width: 720px; }
.generation-status { display: flex; gap: 16px; padding: 10px 12px; background: var(--surface-soft); color: var(--muted); }
.generation-list { display: grid; gap: 8px; margin-top: 14px; max-height: 46vh; overflow: auto; }
.generation-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.generation-row span { min-width: 0; overflow-wrap: anywhere; }
.script-generation-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.script-generation-meta span { padding: 3px 7px; color: var(--muted); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 4px; font-size: 12px; overflow-wrap: anywhere; }
.script-generation-meta .success { color: var(--green); background: var(--green-soft); border-color: #b9d9cf; }
.script-generation-meta .danger { color: var(--red); background: var(--red-soft); border-color: #e7aaa4; }
.generation-progress { display: grid; gap: 7px; margin: 0 0 12px; padding: 12px 14px; color: var(--ink); background: #eef5f3; border: 1px solid #b9d9cf; border-radius: 4px; }
.generation-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.generation-progress-head strong { font-size: 14px; }
.generation-progress-head span, .generation-progress small { color: var(--muted); }
.generation-progress-track { height: 6px; overflow: hidden; background: #d8e5e1; border-radius: 3px; }
.generation-progress-track span { display: block; height: 100%; background: var(--green); transition: width .25s ease; }
.batch-generation-progress { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 20px; margin-bottom: 14px; padding: 14px 16px; border: 1px solid #b8d2c9; border-left: 4px solid var(--green); background: #f2f7f5; box-shadow: 0 5px 16px rgba(28, 69, 56, .07); }
.batch-generation-progress.finished { border-color: #cbd4d0; border-left-color: #65736d; background: #f7f8f7; }
.batch-generation-head { grid-column: 1 / -1; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; min-width: 0; }
.batch-generation-head > div:first-child { min-width: 0; }
.batch-generation-head span { display: block; color: var(--muted); font-size: 12px; }
.batch-generation-head strong { display: block; margin-top: 3px; font-size: 16px; overflow-wrap: anywhere; }
.batch-generation-running { flex: 0 0 auto; padding-top: 4px; color: var(--green) !important; font-weight: 700; }
.batch-generation-count { min-width: 120px; }
.batch-generation-count strong { display: block; font-size: 23px; line-height: 1; }
.batch-generation-count span { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.batch-generation-track { align-self: center; height: 10px; overflow: hidden; border: 1px solid #c4d5cf; background: #dfe9e5; }
.batch-generation-track span { display: block; height: 100%; background: linear-gradient(90deg, #178b70, #51b99b); transition: width .35s ease; }
.batch-generation-progress.finished .batch-generation-track span { background: #65736d; }
.batch-generation-meta { grid-column: 1 / -1; display: flex; align-items: center; gap: 18px; min-width: 0; color: var(--muted); font-size: 12px; }
.batch-generation-meta span { white-space: nowrap; }
.batch-generation-meta b { margin-left: 3px; color: var(--ink); font-size: 14px; }
.batch-generation-meta small { min-width: 0; margin-left: auto; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.batch-generation-close { min-width: 32px; padding-inline: 8px; font-size: 19px; line-height: 1; }

@media (max-width: 900px) {
  .learning-upload-grid, .learning-grid { grid-template-columns: 1fr; }
  .learning-result-strip { grid-template-columns: 1fr; }
  .learning-result-strip > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .learning-result-strip > div:last-child { border-bottom: 0; }
  .learning-file-row, .knowledge-row { align-items: flex-start; flex-direction: column; }
  .knowledge-row > div:last-child { width: 100%; }
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--surface-soft); }

body {
  margin: 0;
  color: var(--ink);
  background: var(--surface-soft);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(36, 92, 133, 0.25);
  outline-offset: 1px;
}

.app-header {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand-block, .header-actions, .toolbar, .toolbar-group, .status-row, .inline-actions, .pagination,
.review-nav, .control-actions, .host-tools, .host-sync-group {
  display: flex;
  align-items: center;
}
.status-row { flex-wrap: wrap; }

.brand-block { gap: 10px; min-width: 0; }
.brand-block > div:last-child { min-width: 0; }
.brand-block strong { display: block; font-size: 16px; line-height: 22px; }
.brand-block span { display: block; max-width: 520px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-mark {
  width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 36px;
  color: #fff; background: #18463b; border-radius: 6px; font-weight: 800;
}
.header-actions { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.workflow-nav {
  height: 52px;
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  overflow-x: auto;
}

.nav-tab {
  min-width: 142px;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 650;
}
.nav-tab span { margin-right: 7px; color: #97a19d; font-size: 11px; }
.nav-tab .nav-beta { display: inline-flex; margin-left: 6px; padding: 2px 5px; border: 1px solid #b9cbd9; border-radius: 3px; color: var(--blue); background: var(--blue-soft); font-size: 9px; font-style: normal; line-height: 1; vertical-align: 1px; }
.nav-tab.nav-utility { min-width: 132px; margin-left: auto; border-left: 1px solid var(--line); color: var(--blue); }
.nav-tab:hover { color: var(--ink); background: var(--surface-soft); }
.nav-tab.active { color: var(--green); border-bottom-color: var(--green); }
.nav-tab.active span { color: var(--green); }
.current-account { max-width: 120px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.app-main { min-height: calc(100vh - 116px); padding: 20px 24px 36px; }
.page-shell { max-width: 1680px; margin: 0 auto; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 14px; }
.page-heading h1 { margin: 0 0 3px; font-size: 22px; line-height: 30px; }
.page-heading p { margin: 0; color: var(--muted); line-height: 20px; }
.summary-strip { display: flex; gap: 0; border: 1px solid var(--line); background: var(--surface); margin-bottom: 14px; overflow-x: auto; }
.summary-item { min-width: 138px; padding: 12px 16px; border-right: 1px solid var(--line); }
.summary-item:last-child { border-right: 0; }
.summary-item strong { display: block; font-size: 20px; line-height: 24px; }
.summary-item span { color: var(--muted); font-size: 12px; }
.event-list { display: grid; }
.event-row { min-height: 72px; display: grid; grid-template-columns: minmax(240px, 1.4fr) minmax(360px, 1fr) auto; gap: 18px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.event-row:last-child { border-bottom: 0; }
.event-row.current { background: #f0f7f4; box-shadow: inset 3px 0 var(--green); }
.event-row-main { min-width: 0; }
.event-row-main strong, .event-row-main span { display: block; }
.event-row-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.event-row-main span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.event-row-stats { display: flex; align-items: center; gap: 20px; color: var(--muted); font-size: 12px; }
.event-row-stats span { white-space: nowrap; }
.event-row-stats b { margin-right: 3px; color: var(--ink); font-size: 15px; }

.panel { border: 1px solid var(--line); background: var(--surface); }
.panel + .panel { margin-top: 14px; }
.panel-header { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0; font-size: 15px; }
.panel-header p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.panel-body { padding: 14px; }
.toolbar { min-height: 52px; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-bottom: 0; background: var(--surface); flex-wrap: wrap; }
.toolbar-group { gap: 8px; flex-wrap: wrap; }
.toolbar .grow { flex: 1 1 280px; }

.input, .select, .textarea {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--ink);
  background: var(--surface);
}
.input, .select { padding: 7px 10px; }
.input { width: 100%; }
.select { min-width: 132px; }
.textarea { width: 100%; padding: 12px; line-height: 1.7; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: #929b97; }
.input:disabled, .textarea:disabled { color: var(--muted); background: var(--surface-soft); }

.button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 5px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 650;
  white-space: nowrap;
}
.button.primary { color: #fff; background: var(--green); border-color: var(--green); }
.button.primary:hover { background: #065f4b; }
.button.secondary { color: var(--ink); background: var(--surface); border-color: var(--line-strong); }
.button.secondary:hover, .button.ghost:hover { background: var(--surface-soft); }
.button.danger { color: var(--red); background: var(--red-soft); border-color: #e7aaa4; }
.button.ghost { color: var(--muted); background: transparent; border-color: transparent; }
.button.small { min-height: 28px; padding: 4px 8px; font-size: 12px; }
.button:disabled { color: #919995; background: #edf0ee; border-color: #d8dedb; cursor: not-allowed; }

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
}
.status-chip.success { color: var(--green); background: var(--green-soft); }
.status-chip.warning { color: var(--amber); background: var(--amber-soft); }
.status-chip.danger { color: var(--red); background: var(--red-soft); }
.status-chip.info { color: var(--blue); background: var(--blue-soft); }
.status-chip.neutral { color: #59635f; background: #f0f2f1; }

.table-wrap { width: 100%; overflow: auto; border: 1px solid var(--line); background: var(--surface); }
.data-table { width: 100%; min-width: 1100px; border-collapse: collapse; table-layout: fixed; }
.data-table th { height: 40px; padding: 8px 10px; color: var(--muted); background: var(--surface-soft); border-bottom: 1px solid var(--line); text-align: left; font-size: 12px; font-weight: 650; }
.data-table td { height: 64px; padding: 8px 10px; border-bottom: 1px solid #e8ecea; vertical-align: middle; overflow: hidden; }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: #f8faf9; }
.data-table tbody tr.selected { background: #edf6f2; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .check-col { width: 42px; text-align: center; }
.data-table .image-col { width: 68px; }
.data-table .code-col { width: 104px; }
.data-table .name-col { width: 170px; }
.data-table .category-col { width: 78px; }
.data-table .material-col { width: 104px; }
.data-table .spec-col { width: 150px; }
.data-table .price-col { width: 96px; }
.data-table .complete-col { width: 116px; }
.data-table .status-col { width: 112px; }
.data-table .action-col { width: 126px; }
.cell-main { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.cell-sub { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-thumb { width: 46px; height: 46px; display: block; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; background: #eef1ef; }
.product-thumb.missing { display: grid; place-items: center; color: var(--muted); font-size: 11px; text-align: center; line-height: 13px; }
.meter { width: 72px; height: 5px; margin-top: 5px; background: #e7ece9; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--green); }

.product-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: 14px; min-width: 0; }
.product-layout > * { min-width: 0; }
.detail-drawer { position: sticky; top: 14px; border: 1px solid var(--line); background: var(--surface); }
.detail-cover { height: 180px; display: grid; place-items: center; background: #eef2ef; border-bottom: 1px solid var(--line); overflow: hidden; }
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.detail-cover .missing-large { color: var(--muted); }
.detail-content { padding: 14px; }
.detail-content h2 { margin: 0 0 4px; font-size: 18px; }
.detail-content > p { margin: 0 0 12px; color: var(--muted); }
.facts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.fact { min-width: 0; padding: 9px 10px; background: var(--surface); }
.fact dt { margin: 0 0 3px; color: var(--muted); font-size: 11px; }
.fact dd { margin: 0; overflow-wrap: anywhere; line-height: 18px; font-weight: 600; }
.fact.locked dt::after { content: " 只读"; color: var(--green); }
.warning-list { margin: 10px 0 0; padding: 0; list-style: none; }
.warning-list li { margin-top: 6px; padding: 8px 9px; color: var(--amber); background: var(--amber-soft); border-left: 3px solid #d59631; line-height: 18px; overflow-wrap: anywhere; }

.review-layout { display: grid; grid-template-columns: 280px minmax(430px, 1fr) 330px; min-height: calc(100vh - 190px); border: 1px solid var(--line); background: var(--surface); min-width: 0; }
.review-layout > * { min-width: 0; }
.review-list { border-right: 1px solid var(--line); overflow: hidden; }
.review-list-toolbar { padding: 10px; border-bottom: 1px solid var(--line); }
.review-items { max-height: calc(100vh - 300px); overflow-y: auto; }
.review-item { width: 100%; min-height: 66px; display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 12px; border: 0; border-bottom: 1px solid #e8ecea; text-align: left; background: #fff; cursor: pointer; }
.review-item:hover { background: var(--surface-soft); }
.review-item.active { background: var(--green-soft); box-shadow: inset 3px 0 var(--green); }
.review-item > span:first-child { min-width: 0; overflow: hidden; }
.review-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-item small { display: block; margin-top: 4px; color: var(--muted); }
.review-editor { min-width: 0; }
.review-editor-header, .review-facts-header { min-height: 66px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.review-editor-header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.review-editor-header h1 { margin: 0 0 4px; font-size: 18px; }
.review-editor-header p { margin: 0; color: var(--muted); }
.review-editor-body { padding: 14px; }
.editor-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.editor-label strong { font-size: 13px; }
.script-editor { min-height: 360px; }
.rich-text-toolbar { min-height: 42px; display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--line); border-bottom: 0; background: #f7f9f8; }
.rich-tool, .rich-swatch { flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border: 1px solid #b9c5bf; border-radius: 4px; background: #fff; cursor: pointer; }
.rich-tool:hover, .rich-swatch:hover { border-color: var(--green); box-shadow: 0 0 0 2px rgba(24, 70, 59, .1); }
.rich-tool.active, .rich-swatch.active { border-color: var(--green); box-shadow: 0 0 0 2px rgba(24, 70, 59, .18); background: var(--green-soft); }
.rich-tool-separator { width: 1px; height: 24px; margin: 0 2px; background: var(--line); }
.rich-size-select { width: 96px; height: 30px; border: 1px solid #b9c5bf; border-radius: 4px; color: var(--ink); background: #fff; }
.rich-swatch { position: relative; }
.rich-swatch::after { width: 17px; height: 17px; border: 1px solid rgba(0, 0, 0, .18); border-radius: 2px; content: ''; background: var(--swatch, #27332f); }
.rich-swatch.default { --swatch: #27332f; }
.rich-swatch.warm { --swatch: #d84b39; }
.rich-swatch.yellow { --swatch: #ad7300; }
.rich-swatch.mint { --swatch: #19714d; }
.rich-swatch.sky { --swatch: #176899; }
.rich-paste-note { margin-left: auto; color: var(--muted); font-size: 12px; }
.rich-text-editor { --rich-base-size: 16px; width: 100%; padding: 12px; border: 1px solid #bfc9c4; color: var(--ink); background: #fff; font-size: var(--rich-base-size); line-height: 1.7; overflow-y: auto; overflow-wrap: anywhere; outline: 0; }
.rich-text-editor:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(24, 70, 59, .12); }
.rich-text-editor:empty::before { color: #929b97; content: attr(data-placeholder); pointer-events: none; }
.rich-text-content, .rich-text-editor { --rt-color-warm: #b72f24; --rt-color-yellow: #8a5a00; --rt-color-mint: #146b46; --rt-color-sky: #12618f; }
.rich-text-content p, .rich-text-editor p { margin: 0 0 .9em; }
.rich-text-content p:last-child, .rich-text-editor p:last-child { margin-bottom: 0; }
.rt-size-small { font-size: calc(var(--rich-base-size) * .82); }
.rt-size-emphasis { font-size: calc(var(--rich-base-size) * 1.16); }
.rt-size-key { font-size: calc(var(--rich-base-size) * 1.34); }
.rt-color-warm { color: var(--rt-color-warm); }
.rt-color-yellow { color: var(--rt-color-yellow); }
.rt-color-mint { color: var(--rt-color-mint); }
.rt-color-sky { color: var(--rt-color-sky); }
.script-risk-preview { margin-top: 10px; border: 1px solid #e7aaa4; background: #fff8f7; }
.script-risk-preview-header { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 10px; border-bottom: 1px solid #f0c8c3; color: var(--muted); font-size: 12px; }
.script-risk-preview-header strong { color: var(--red); }
.script-risk-preview-text { min-height: 80px; max-height: 260px; overflow-y: auto; padding: 10px; line-height: 1.7; white-space: normal; overflow-wrap: anywhere; }
.script-risk-preview .risk-highlight { appearance: none; display: inline; margin: 0; padding: 0 2px; border: 0; border-bottom: 2px solid #d53c32; color: #a51d17; background: #ffd6d1; font: inherit; line-height: inherit; cursor: pointer; }
.script-risk-preview .risk-highlight:hover, .script-risk-preview .risk-highlight:focus-visible { background: #ffc4bd; outline: 2px solid #a51d17; outline-offset: 1px; }
.script-risk-action { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border-top: 1px solid #f0c8c3; background: #fff; }
.script-risk-action[hidden] { display: none; }
.script-risk-action span { color: var(--muted); font-size: 13px; }
.script-risk-action strong { color: var(--red); }
.ignored-risk-panel { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 10px; padding: 10px; border: 1px solid #d9dfdc; background: #f7f9f8; }
.ignored-risk-panel > div:first-child strong, .ignored-risk-panel > div:first-child span { display: block; }
.ignored-risk-panel > div:first-child span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.ignored-risk-list { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.ignored-risk-item { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding-left: 9px; border: 1px solid #cfd8d3; background: #fff; }
.ignored-risk-item b { color: #555f5a; font-size: 13px; }
.review-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.review-nav { justify-content: space-between; margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.review-facts { border-left: 1px solid var(--line); background: #fbfcfb; min-width: 0; }
.review-facts-header h2 { margin: 0 0 3px; font-size: 14px; }
.review-facts-header p { margin: 0; color: var(--muted); font-size: 12px; }
.review-facts-body { padding: 12px; }
.facts-stack { margin: 0; border: 1px solid var(--line); background: #fff; }
.facts-stack .fact { display: grid; grid-template-columns: 84px 1fr; gap: 8px; border-bottom: 1px solid #e8ecea; }
.facts-stack .fact:last-child { border-bottom: 0; }
.risk-box { margin-top: 12px; padding: 10px; border: 1px solid #efd0a0; background: var(--amber-soft); }
.risk-box.safe { border-color: #abd4c7; background: var(--green-soft); }
.risk-box strong { display: block; margin-bottom: 5px; }
.risk-box ul { margin: 0; padding-left: 18px; }
.immutable-note { margin-top: 12px; padding: 10px; color: var(--blue); background: var(--blue-soft); border-left: 3px solid var(--blue); line-height: 19px; }

.rundown-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
.rundown-list { border: 1px solid var(--line); background: var(--surface); }
.rundown-row { min-height: 72px; display: grid; grid-template-columns: 54px 1fr 116px 204px; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid #e6ebe8; }
.rundown-row:last-child { border-bottom: 0; }
.rundown-row.skipped { opacity: 0.65; background: #f5f6f5; }
.rundown-row.live { background: var(--green-soft); box-shadow: inset 3px 0 var(--green); }
.order-number { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line-strong); font-weight: 750; background: #fff; }
.rundown-product { min-width: 0; display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 10px; align-items: center; }
.rundown-product strong, .candidate-row strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rundown-product small, .candidate-row small { display: block; margin-top: 3px; color: var(--muted); }
.candidate-list { max-height: 620px; overflow-y: auto; }
.candidate-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid #e8ecea; }
.candidate-row:last-child { border-bottom: 0; }

.control-status { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-bottom: 14px; border: 1px solid var(--line); background: var(--line); }
.control-status-item { padding: 11px 13px; background: var(--surface); min-width: 0; }
.control-status-item span { display: block; color: var(--muted); font-size: 11px; }
.control-status-item strong { display: block; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.control-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.control-panel { min-width: 0; border: 1px solid var(--line); background: var(--surface); }
.control-panel.preview { border-top: 4px solid var(--amber); }
.control-panel.published { border-top: 4px solid var(--green); }
.control-panel-header { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.control-panel-header h2 { margin: 0 0 3px; font-size: 16px; }
.control-panel-header p { margin: 0; color: var(--muted); font-size: 12px; }
.control-panel-body { padding: 14px; }
.control-product-head { min-height: 86px; display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; align-items: center; }
.control-product-head .product-thumb { width: 76px; height: 76px; }
.control-product-head h3 { margin: 0 0 5px; font-size: 19px; overflow-wrap: anywhere; }
.control-product-head p { margin: 0; color: var(--muted); }
.control-script-preview { --rich-base-size: 16px; min-height: 250px; margin-top: 12px; padding: 13px; border: 1px solid var(--line); background: #fafbfa; white-space: pre-wrap; line-height: 1.7; overflow-wrap: anywhere; }
.control-section-label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: 12px; font-weight: 650; }
.control-actions { min-height: 58px; justify-content: space-between; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.control-search-results { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-top: 0; }
.search-result { width: 100%; display: flex; justify-content: space-between; gap: 8px; padding: 9px 10px; border: 0; border-bottom: 1px solid #e8ecea; background: #fff; text-align: left; cursor: pointer; }
.search-result:last-child { border-bottom: 0; }
.search-result:hover { background: var(--surface-soft); }
.published-empty { min-height: 420px; display: grid; place-items: center; text-align: center; color: var(--muted); }
.published-empty strong { display: block; margin-bottom: 4px; color: var(--ink); font-size: 17px; }
.version-banner { padding: 8px 10px; color: var(--green); background: var(--green-soft); border-left: 3px solid var(--green); }

.empty-state, .error-state, .loading-state { min-height: 280px; display: grid; place-items: center; align-content: center; gap: 10px; color: var(--muted); text-align: center; }
.error-state { color: var(--red); }
.spinner { width: 22px; height: 22px; border: 3px solid #d9e1dd; border-top-color: var(--green); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 30; max-width: min(430px, calc(100vw - 40px)); padding: 11px 13px; color: #fff; background: #23302c; border-radius: 5px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity 0.18s ease, transform 0.18s ease; overflow-wrap: anywhere; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }

/* 主播屏 */
.host-body {
  --host-bg: #0c0d10;
  --host-surface: #151e2b;
  --host-surface-raised: #202c3d;
  --host-line: #2d577b;
  --host-muted: #b9c8d8;
  --host-text: #fffaf5;
  --host-teal: #5be2bf;
  --host-warm: #ffd166;
  --host-violet: #72baff;
  --host-coral: #2ea9ff;
  height: 100vh;
  color: var(--host-text);
  background: linear-gradient(112deg, #07101a 0%, #10243a 36%, #0b1727 66%, #070c14 100%);
  overflow: hidden;
  font-family: "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
.host-toolbar { position: relative; height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 8px 22px; border-bottom: 1px solid #2c567a; background: linear-gradient(90deg, #091522 0%, #163452 48%, #091522 100%); box-shadow: inset 0 -1px 0 rgba(163, 217, 255, .14), 0 8px 28px rgba(0, 0, 0, .3); }
.host-toolbar-left { display: flex; align-items: center; gap: 18px; min-width: 0; }
.host-screen-title { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #eaf7ff; font-size: 21px; font-weight: 850; letter-spacing: .12em; text-shadow: 0 0 8px rgba(96, 191, 255, .75), 0 1px 0 #08111b; white-space: nowrap; }
.host-brand { display: flex; align-items: center; gap: 9px; min-width: 0; color: #eff8f6; }
.host-brand strong { font-size: 15px; white-space: nowrap; }
.host-brand-mark { display: inline-flex; align-items: center; min-height: 23px; padding: 3px 7px; color: #06121d; background: linear-gradient(180deg, #91ddff 0%, #2ea9ff 58%, #1b77bd 100%); border-radius: 4px; font-size: 10px; font-weight: 900; box-shadow: 0 0 18px rgba(46, 169, 255, .42), inset 0 1px 0 rgba(255, 255, 255, .62); }
.host-sync-group { gap: 10px; min-width: 0; color: #c5c9d1; font-size: 13px; }
.host-sync-group span { white-space: nowrap; }
.host-sync-group #host-version { color: var(--host-muted); }
.sync-dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; background: var(--host-warm); }
.sync-dot.online { background: var(--host-teal); box-shadow: 0 0 0 3px rgba(56, 210, 176, 0.16); }
.sync-dot.offline { background: #e16861; }
.sync-dot.connecting { animation: pulse 1.2s ease infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.host-tools { gap: 7px; }
.host-tool { min-width: 42px; height: 34px; padding: 5px 10px; border: 1px solid #46505a; border-radius: 5px; color: #f0f2f5; background: #1a1e23; cursor: pointer; }
.host-tool:hover { border-color: var(--host-coral); color: #fff; background: #183b5a; }
.host-stage { height: calc(100vh - 54px); min-height: 0; overflow: hidden; }
.host-empty { min-height: calc(100vh - 54px); display: grid; place-items: center; align-content: center; gap: 8px; text-align: center; padding: 30px; }
.host-empty-index { min-width: 80px; padding: 8px 14px; color: #0a1012; background: var(--host-warm); font-weight: 800; }
.host-empty h1 { margin: 12px 0 0; font-size: 32px; }
.host-empty p { margin: 0; color: var(--host-muted); }
.host-page { height: 100%; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr); overflow: hidden; }
.host-current { height: 100%; min-height: 0; display: flex; gap: 0; padding: 12px 14px 16px; overflow: hidden; }
.host-product { flex: 0 0 var(--host-left-width, 31%); min-width: 0; padding: 12px 14px 15px; border: 1px solid var(--host-line); border-top: 3px solid #66c8ff; border-radius: 8px; background: linear-gradient(118deg, rgba(125, 201, 255, .13) 0%, transparent 22%, transparent 70%, rgba(34, 90, 145, .18) 100%), linear-gradient(145deg, #172a40 0%, #151e2b 64%, #101a29 100%); box-shadow: inset 0 1px 0 rgba(196, 232, 255, .2), inset 0 -1px 0 rgba(2, 8, 15, .8), 0 12px 32px rgba(0, 0, 0, .3); overflow: hidden; }
.host-resizer { position: relative; z-index: 2; flex: 0 0 12px; display: grid; place-items: center; color: #78818e; user-select: none; touch-action: none; }
.host-resizer::after { width: 3px; height: 42px; content: ''; border-radius: 999px; background: #4a5260; transition: background .16s ease, box-shadow .16s ease; }
.host-resizer:hover::after, .host-resizing .host-resizer::after { background: var(--host-coral); box-shadow: 0 0 14px rgba(46, 169, 255, .58); }
.host-resizer.horizontal { flex: 0 0 12px; cursor: row-resize; }
.host-resizer.horizontal::after { width: 42px; height: 3px; }
.host-resizer.vertical { cursor: col-resize; }
.host-image-frame { position: relative; width: 100%; height: clamp(116px, 18vh, 220px); min-height: 116px; display: grid; place-items: center; overflow: hidden; border: 1px solid #4b5059; border-radius: 6px; background: #0d0f12; }
.host-image { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
.host-image-missing { color: var(--host-muted); border-style: dashed; }
.host-code { display: inline-flex; margin-top: 9px; padding: 4px 9px; color: #081014; background: var(--host-warm); font-size: 14px; font-weight: 850; }
.host-product h1 { max-height: 2.45em; margin: 8px 0 10px; font-size: 30px; line-height: 1.2; overflow: hidden; overflow-wrap: anywhere; }
.host-section-label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 8px; color: var(--host-text); }
.host-section-label strong { font-size: 18px; }
.host-section-label span { color: var(--host-muted); font-size: 14px; }
.host-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 0; border: 1px solid var(--host-line); background: var(--host-line); }
.host-fact { min-width: 0; display: grid; gap: 3px; padding: 8px 10px 9px; background: var(--host-surface-raised); }
.host-fact.material { background: #202534; }
.host-fact.dimensions { background: #1b2839; }
.host-fact.weight { background: #202936; }
.host-fact.price { background: #2b2518; }
.host-fact.count { background: #1d2838; }
.host-fact.stock { background: #142b2d; }
.host-fact dt { color: var(--host-muted); font-size: 15px; }
.host-fact dd { min-width: 0; margin: 0; color: var(--host-text); font-size: 34px; line-height: 1.1; font-weight: 750; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.host-fact.price dd { color: var(--host-warm); font-size: 36px; }
.host-fact.stock dd { color: var(--host-teal); font-size: 34px; }
.host-pane { min-width: 0; min-height: 0; border: 1px solid var(--host-line); border-radius: 7px; background: linear-gradient(118deg, rgba(117, 194, 255, .12) 0%, transparent 23%, transparent 72%, rgba(39, 94, 150, .15) 100%), linear-gradient(145deg, #17283c 0%, #121c2a 68%, #0c1522 100%); box-shadow: inset 0 1px 0 rgba(194, 232, 255, .18), inset 0 -1px 0 rgba(0, 5, 12, .75), 0 10px 26px rgba(0, 0, 0, .24); overflow: hidden; }
.host-pane-slot { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.host-pane-slot > .host-pane { flex: 1 1 auto; }
.host-pane-slot.is-empty { display: none; }
.host-sidebar { flex: 0 0 var(--host-right-width, 28%); min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.host-sidebar.single-pane .host-pane-slot:not(.is-empty) { flex: 1 1 auto; }
.host-resizer.is-hidden, .host-current.host-sidebar-empty > .host-resizer[data-resizer="right"], .host-current.host-sidebar-empty .host-sidebar { display: none; }
.strategy-slot { flex: 0 0 var(--host-strategy-height, 34%); }
.variants-slot { flex: 1 1 auto; }
.host-pane-heading, .host-section-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.host-pane-heading { flex: 0 0 auto; padding: 14px 15px 10px; border-bottom: 1px solid var(--host-line); }
.host-pane-heading h3 { margin: 3px 0 0; color: var(--host-text); font-size: 22px; line-height: 1.15; }
.host-pane-kicker { color: var(--host-coral); font-size: 11px; font-weight: 850; letter-spacing: .04em; }
.host-pane-close { display: inline-grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px; padding: 0; border: 1px solid #416b8e; border-radius: 50%; color: #d8e9f5; background: linear-gradient(180deg, #22384d 0%, #142231 100%); box-shadow: inset 0 1px 0 rgba(213, 239, 255, .15); font-size: 20px; line-height: 1; cursor: pointer; }
.host-pane-close:hover { border-color: var(--host-coral); color: #fff; background: #17466b; box-shadow: 0 0 12px rgba(46, 169, 255, .35); }
.host-variant-section { display: flex; flex-direction: column; gap: 0; margin-top: 0; height: 100%; }
.host-variant-section .host-section-label { flex: 0 0 auto; padding: 13px 15px 10px; margin: 0; }
.host-variant-columns { display: none; }
.host-pane-in-rail .host-variant-columns { flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, .55fr) minmax(0, 1.1fr) minmax(0, .7fr); gap: 1px; padding: 0 8px 4px; color: var(--host-muted); font-size: var(--host-variant-label-size, 12px); }
.host-pane-in-rail .host-variant-columns span { min-width: 0; padding: 0 var(--host-variant-padding-x, 8px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.host-pane-in-rail .host-variant-columns span:nth-child(n + 5) { display: none; }
.host-variants-two-column .host-variant-columns { grid-template-columns: repeat(2, minmax(0, 1.65fr) minmax(0, .55fr) minmax(0, 1.1fr) minmax(0, .7fr)); }
.host-variants-two-column .host-variant-columns span:nth-child(n + 5) { display: block; }
.host-variants { min-height: 0; flex: 1 1 auto; display: grid; grid-auto-rows: max-content; align-content: start; gap: var(--host-variant-card-gap, 6px); padding: 0 8px 10px; overflow: hidden; background: transparent; }
.host-variants-two-column .host-variants { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.host-pane-in-rail.host-variants-two-column .host-variant { grid-template-columns: minmax(0, 1.65fr) minmax(0, .55fr) minmax(0, 1.1fr) minmax(0, .7fr); }
.host-variants-two-column .host-variant-value { display: block; overflow: hidden; overflow-wrap: normal; text-overflow: clip; white-space: nowrap; }
.host-variant { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; padding: 1px; border: 1px solid var(--host-line); background: var(--host-line); line-height: 1.25; font-variant-numeric: tabular-nums; }
.host-variant-cell { min-width: 0; display: grid; gap: var(--host-variant-cell-gap, 3px); align-content: start; padding: var(--host-variant-padding-y, 6px) var(--host-variant-padding-x, 8px); background: var(--host-surface-raised); }
.host-variant-code, .host-variant-spec { grid-column: auto; }
.host-pane-in-rail .host-variant { grid-template-columns: minmax(0, 1.65fr) minmax(0, .55fr) minmax(0, 1.1fr) minmax(0, .7fr); }
.host-pane-in-rail .host-variant-cell { display: block; align-content: center; }
.host-pane-in-rail .host-variant-cell span { display: none; }
.host-variants-mini-grid .host-variant-columns { display: block; padding-bottom: 4px; }
.host-variants-mini-grid .host-variant-columns::before { content: '\6bcf\683c\ff1a\7f16\7801  /  \89c4\683c  /  \4ef7\683c  /  \5e93\5b58'; display: block; padding: 0 var(--host-variant-padding-x, 4px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.host-variants-mini-grid .host-variant-columns span { display: none !important; }
.host-variants-mini-grid .host-variants { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.host-variants-mini-grid .host-variant { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.host-variants-condensed-table .host-variant-columns,
.host-variants-condensed-table .host-variant { grid-template-columns: minmax(0, 1.65fr) minmax(0, .55fr) minmax(0, 1.1fr) minmax(0, .7fr); }
.host-variants-condensed-table .host-variant-columns { padding-bottom: 2px; }
.host-variants-condensed-table .host-variants { grid-template-columns: minmax(0, 1fr); gap: 1px; padding-bottom: 4px; }
.host-variants-condensed-table .host-variant { line-height: 1.05; }
.host-variants-condensed-table .host-variant-cell { padding-top: 1px; padding-bottom: 1px; font-size: 0; line-height: 1; }
.host-variants-condensed-table .host-variant-value { display: block; overflow: hidden; overflow-wrap: normal; text-overflow: clip; white-space: nowrap; }
.host-variant-code { background: #202535; }
.host-variant-spec { background: #1b2839; }
.host-variant-price-cell { background: #2b2518; }
.host-variant-stock-cell { background: #142b2d; }
.host-variant-cell span { color: var(--host-muted); font-size: var(--host-variant-label-size, 12px); line-height: 1.1; }
.host-variant-value { min-width: 0; font-size: var(--host-variant-value-size, 23px); line-height: 1.15; overflow-wrap: anywhere; }
.host-variant-price { color: var(--host-warm); }
.host-pane-in-rail .host-variant-price { display: block; overflow: hidden; overflow-wrap: normal; text-overflow: clip; white-space: nowrap; }
.host-variant-stock { color: var(--host-teal); }
.host-variant-mini { display: none; }
.host-variants-mini-grid .host-variant > .host-variant-cell { display: none; }
.host-variants-mini-grid .host-variant-mini { min-width: 0; display: grid; gap: 2px; padding: 3px 4px; font-size: var(--host-variant-value-size, 9px); line-height: 1.12; overflow-wrap: anywhere; }
.host-variants-mini-grid .host-variant-mini div { min-width: 0; }
.host-variants-pane.host-variants-compressed .host-section-label { padding-top: 10px; padding-bottom: 8px; }
.host-script { flex: 1 1 auto; min-width: 0; min-height: 0; position: relative; display: flex; flex-direction: column; padding: 22px 28px 24px; border: 1px solid var(--host-line); border-top: 3px solid var(--host-coral); border-radius: 8px; overflow: hidden; background: linear-gradient(118deg, rgba(125, 204, 255, .11) 0%, transparent 20%, transparent 72%, rgba(31, 83, 139, .14) 100%), linear-gradient(145deg, #14253a 0%, #101a29 60%, #0a1320 100%); box-shadow: inset 0 1px 0 rgba(199, 234, 255, .2), inset 0 -1px 0 rgba(0, 5, 12, .82), 0 12px 32px rgba(0, 0, 0, .3); }
.host-script::before { position: absolute; top: 0; bottom: 0; left: 0; width: 5px; content: ''; background: var(--host-coral); opacity: .9; }
.host-script-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
.host-script-kicker { display: block; color: var(--host-coral); font-size: 12px; font-weight: 800; }
.host-script-heading h2 { margin: 4px 0 0; color: var(--host-text); font-size: 24px; line-height: 1.2; }
.host-script-count { color: var(--host-muted); font-size: 15px; }
.host-strategy-content { flex: 1 1 auto; min-height: 0; padding: 13px 15px 16px; color: #f4faff; background: linear-gradient(120deg, #203d59 0%, #1a2b40 54%, #111e2e 100%); border-left: 5px solid var(--host-coral); box-shadow: inset 0 1px 0 rgba(184, 227, 255, .16); line-height: 1.45; font-size: 28px; overflow: hidden; overflow-wrap: anywhere; }
.host-script-extra, .host-product-extra { min-width: 0; flex: 0 0 auto; }
.host-script-extra:not(.is-empty), .host-product-extra:not(.is-empty) { margin-top: 12px; margin-bottom: 14px; }
.host-script-extra .host-pane, .host-product-extra .host-pane { max-height: 30%; }
.host-script-extra .host-pane { max-height: none; overflow: visible; }
.host-script-extra .host-strategy-content { min-height: 0; max-height: none; overflow: visible; }
.host-product-extra { container-type: inline-size; }
.host-product-extra .host-variant-section { height: auto; }
.host-product-extra .host-variants { padding: 0; overflow: visible; }
.host-product-extra .host-variant { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.host-product-extra .host-variant-code, .host-product-extra .host-variant-spec { grid-column: 1 / -1; }
.host-product-extra .host-variant-cell { gap: 3px; padding: 7px 9px 8px; }
.host-product-extra .host-variant-cell span { font-size: clamp(13px, 1.7cqw, 16px); }
.host-product-extra .host-variant-value { min-width: 0; font-size: clamp(23px, 3.2cqw, 32px); line-height: 1.25; overflow-wrap: anywhere; }
.host-product-extra.variants-inline .host-variant { grid-template-columns: minmax(145px, 1fr) minmax(220px, 1.65fr) minmax(130px, .9fr) minmax(105px, .75fr); }
.host-product-extra.variants-inline .host-variant-code, .host-product-extra.variants-inline .host-variant-spec { grid-column: auto; }
.host-product-with-variants .host-image-frame { height: 100px; min-height: 100px; }
.host-product-with-variants h1 { max-height: 2.2em; margin-top: 6px; margin-bottom: 7px; font-size: 26px; }
.host-product-with-variants .host-fact { padding: 6px 8px 7px; }
.host-product-with-variants .host-fact dt { font-size: 13px; }
.host-product-with-variants .host-fact dd { font-size: 28px; }
.host-product-with-variants .host-fact.price dd { font-size: 30px; }
.host-product-with-variants .host-fact.stock dd { font-size: 29px; }
.host-product-extra .host-section-label { padding: 0 0 5px; }
.host-script-text { --rich-base-size: 34px; --rt-color-warm: #ff9a84; --rt-color-yellow: #ffe08a; --rt-color-mint: #91e7bf; --rt-color-sky: #8bd3ff; min-height: 0; flex: 1 1 auto; overflow-y: auto; padding: 2px 17px 12px 0; color: #fffaf5; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--rich-base-size); line-height: 1.58; font-weight: 600; scrollbar-color: #7a5260 #111216; }
.host-script-text p { margin: 0 0 1.2em; }
.host-script-text.size-small { --rich-base-size: 30px; }
.host-script-text.size-large { --rich-base-size: 40px; }
.host-body.low-contrast { --host-bg: #161419; --host-surface: #242128; --host-surface-raised: #302b34; --host-line: #655d69; color: #fff; background: #161419; }
.host-body.low-contrast .host-product { background: #242128; }
.host-body.low-contrast .host-script { background: #161419; }

.import-upload-panel { max-width: 980px; margin: 0 auto; }
.import-stepper { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.import-stepper span { padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 13px; }
.import-stepper span.active { color: var(--ink); border-color: var(--green); background: var(--green-soft); }
.upload-drop { display: grid; justify-items: center; gap: 10px; padding: 54px 24px; border: 1px dashed var(--line-strong); border-radius: 12px; background: linear-gradient(135deg, rgba(224,180,85,.08), rgba(72,170,135,.06)); text-align: center; }
.upload-drop h2 { margin: 0; }
.upload-drop p { max-width: 560px; margin: 0 0 8px; color: var(--muted); }
.upload-icon, .success-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; color: #fff; background: var(--green); font-size: 26px; font-weight: 800; }
.import-safety, .import-sensitive-note { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; padding: 12px 14px; border-left: 3px solid var(--green); color: var(--muted); background: var(--surface-soft); }
.import-safety strong, .import-sensitive-note strong { color: var(--ink); white-space: nowrap; }
.import-sheet-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.import-sheet-card { display: flex; gap: 10px; min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: var(--surface); }
.import-sheet-card:has(input:checked) { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-soft); }
.import-sheet-card.script, .import-sheet-card.system { opacity: .68; cursor: not-allowed; }
.import-sheet-body { display: grid; min-width: 0; gap: 4px; }
.import-sheet-body span, .import-sheet-body small { color: var(--muted); overflow-wrap: anywhere; }
.import-mapping-panel { margin-top: 14px; }
.import-field-group-heading { display: flex; align-items: baseline; gap: 8px; margin: 16px 0 6px; color: var(--green); font-weight: 800; }
.import-field-group-heading small { color: var(--muted); font-weight: 500; }
.import-mapping-row { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(300px, 1.2fr); align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.import-mapping-row > div:first-child { display: grid; gap: 4px; }
.import-mapping-row small { color: var(--muted); overflow-wrap: anywhere; }
.import-mapping-row em { color: var(--red); font-style: normal; font-size: 11px; }
.import-mapping-row > div:last-child { display: flex; align-items: center; gap: 8px; min-width: 0; }
.import-mapping-select { min-width: 0; flex: 1; }
.import-column-picker { position: relative; min-width: 0; flex: 1; }
.import-column-picker summary { display: grid; gap: 2px; min-height: 38px; padding: 6px 34px 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); cursor: pointer; list-style: none; }
.import-column-picker summary::-webkit-details-marker { display: none; }
.import-column-picker summary::after { position: absolute; top: 11px; right: 12px; content: '▾'; color: var(--muted); }
.import-column-picker[open] summary { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-soft); }
.import-column-picker summary span, .import-column-picker summary small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-column-picker summary small { font-size: 11px; }
.import-column-menu { position: absolute; z-index: 20; top: calc(100% + 5px); left: 0; right: 0; display: grid; max-height: 260px; overflow: auto; padding: 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); box-shadow: var(--shadow); }
.import-column-menu label { display: flex; align-items: flex-start; gap: 8px; padding: 7px 8px; border-radius: 4px; cursor: pointer; }
.import-column-menu label:hover { background: var(--surface-soft); }
.import-column-menu input { margin-top: 2px; }
.import-column-menu span { min-width: 0; overflow-wrap: anywhere; }
.import-issues { margin-top: 14px; }
.import-issue { display: flex; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.import-issue strong { flex: 0 0 150px; }
.import-issue.error strong { color: var(--red); }
.import-issue.warning strong { color: var(--amber); }
.import-group { padding: 12px 0; border-top: 1px solid var(--line); }
.import-group-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.import-variant { display: grid; grid-template-columns: 42px minmax(0, 1.6fr) minmax(80px, 1fr) minmax(100px, .8fr) minmax(70px, .6fr); gap: 10px; align-items: center; }
.import-group-head { margin-bottom: 6px; }
.import-group-head span, .import-variant { color: var(--muted); font-size: 13px; }
.import-variant { padding: 5px 0; border-top: 1px dashed var(--line); }
.import-variant span { min-width: 0; overflow-wrap: anywhere; }
.import-variant img, .import-image-missing { width: 36px; height: 36px; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; }
.import-image-missing { display: grid; place-items: center; color: var(--muted); font-size: 10px; background: var(--surface-soft); }
.page-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
.import-success { display: grid; justify-items: center; gap: 10px; min-height: 420px; align-content: center; text-align: center; }
.import-success h1 { margin: 0; }
.import-success p { color: var(--muted); }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 2px; color: var(--muted); font-size: 13px; }
.pagination > div { display: flex; gap: 6px; }

.event-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--line); background: var(--surface-soft); }
.event-toolbar label { display: grid; grid-template-columns: auto minmax(260px, 520px); align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.subtabs { display: flex; gap: 2px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.subtab { min-height: 38px; padding: 8px 14px; border: 0; border-bottom: 3px solid transparent; color: var(--muted); background: transparent; cursor: pointer; }
.subtab.active { color: var(--green); border-bottom-color: var(--green); font-weight: 750; }
.variant-cards { display: grid; gap: 6px; margin: 10px 0; }
.variant-card { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(70px, .8fr) auto auto; gap: 8px; align-items: center; padding: 7px 9px; border-left: 3px solid var(--line-strong); background: var(--surface-soft); font-size: 12px; }
.variant-card span { min-width: 0; overflow-wrap: anywhere; }
.legacy-match-panel { display: grid; gap: 8px; margin-top: 10px; padding: 11px; border-left: 3px solid var(--amber); background: #fff9ec; }
.legacy-match-panel p { margin: 0; color: var(--muted); line-height: 1.55; overflow-wrap: anywhere; }
.legacy-match-panel label { display: flex; gap: 7px; align-items: flex-start; color: var(--muted); font-size: 12px; line-height: 1.45; }
.legacy-match-panel .inline-actions { flex-wrap: wrap; }
.review-product-image { padding: 12px 14px 0; }
.review-product-image .review-large { width: 100%; height: 150px; object-fit: cover; }
.opening-editor { max-width: 980px; margin: 0 auto; }
.opening-editor .panel-body { padding: 16px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(17, 24, 21, .58); }
.modal-card { width: min(1180px, 96vw); max-height: 92vh; overflow: hidden; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.modal-body { max-height: calc(92vh - 132px); overflow: auto; padding: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.form-grid label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.variant-edit-heading { display: flex; justify-content: space-between; align-items: center; margin: 18px 0 8px; }
.variant-edit-row { display: grid; grid-template-columns: 1.1fr .8fr 1fr 1fr .7fr .6fr auto; gap: 7px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.import-match { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, auto); gap: 8px 14px; margin: 8px 0 10px; padding: 10px; border-left: 3px solid var(--amber); background: #fff9ec; }
.import-match.identity_conflict { border-left-color: var(--red); background: #fff4f3; }
.import-match > div { display: grid; gap: 3px; }
.import-match span, .import-match label { color: var(--muted); font-size: 12px; }
.import-match label { grid-column: 1 / -1; }
.compact-variant-table { margin: 10px 0; border-top: 1px solid var(--line); }
.compact-variant-table > div { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(80px, 1fr) auto auto; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.compact-variant-table span { overflow-wrap: anywhere; }
.control-script-editor { min-height: 260px; max-height: 520px; line-height: 1.65; }
.mirror-panel { margin-top: 14px; }
.reader-workspace { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; padding: 14px; background: var(--surface-soft); }
.reader-remote { min-height: 300px; display: flex; flex-direction: column; padding: 16px; border: 1px solid #bfc9c4; background: linear-gradient(150deg, #fbfcfb 0%, #edf2f0 100%); box-shadow: inset 0 1px 0 #fff, 0 6px 18px rgba(30, 47, 40, .08); }
.reader-remote-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.reader-remote-head span { color: var(--muted); font-size: 12px; }
.reader-remote-head strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.reader-remote-control { min-height: 248px; display: grid; grid-template-rows: auto minmax(130px, 1fr) auto; gap: 10px; margin: 16px 0; }
.reader-remote-button { min-height: 76px; display: grid; grid-template-columns: 48px 1fr; align-items: center; padding: 10px 16px; border: 1px solid #aebbb5; border-radius: 6px; color: var(--ink); background: #fff; box-shadow: 0 3px 8px rgba(28, 42, 36, .08); cursor: pointer; text-align: left; }
.reader-remote-button.compact { min-height: 48px; grid-template-columns: 34px 1fr; padding: 6px 12px; }
.reader-remote-button:hover { border-color: var(--green); background: var(--green-soft); }
.reader-remote-button:active { transform: translateY(1px); box-shadow: none; }
.reader-remote-button span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: #fff; background: #18463b; font-size: 25px; line-height: 1; }
.reader-remote-button.compact span { width: 28px; height: 28px; font-size: 19px; }
.reader-remote-button strong { font-size: 16px; }
.reader-slider-wrap { position: relative; min-height: 132px; display: grid; place-items: center; color: var(--muted); font-size: 10px; }
.reader-slider-wrap > span:first-child { position: absolute; top: 1px; left: 8px; }
.reader-slider-wrap > span:last-child { position: absolute; bottom: 1px; left: 8px; }
.reader-position-slider { position: absolute; width: 128px; height: 28px; margin: 0; transform: rotate(90deg); accent-color: #18463b; cursor: ns-resize; }
.reader-position-slider:focus-visible { outline: 3px solid rgba(24, 70, 59, .22); outline-offset: 3px; }
.reader-remote small { margin-top: auto; color: var(--muted); }
.host-mirror-wrap { min-width: 0; }
.host-mirror-frame { position: relative; width: 100%; min-height: 240px; overflow: hidden; border: 1px solid #283542; background: #07101a; box-shadow: 0 8px 24px rgba(8, 18, 28, .2); }
.host-mirror-frame iframe { position: absolute; inset: 0 auto auto 0; display: block; border: 0; transform-origin: top left; pointer-events: none; }
.host-mirror-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 2px 0; color: var(--muted); font-size: 11px; }
.host-script-text p { margin: 0 0 1.2em; }

@media (max-width: 760px) {
  .import-mapping-row { grid-template-columns: 1fr; gap: 8px; }
  .import-variant { grid-template-columns: 36px 1.4fr 1fr .8fr .7fr; font-size: 12px; }
  .page-actions { flex-direction: column; }
  .event-toolbar, .event-toolbar label { display: grid; grid-template-columns: 1fr; align-items: stretch; }
  .form-grid { grid-template-columns: 1fr; }
  .variant-edit-row { grid-template-columns: 1fr 1fr; }
  .reader-workspace { grid-template-columns: 1fr; }
  .reader-remote { min-height: auto; }
  .reader-remote-control { min-height: 220px; grid-template-columns: 1fr 120px 1fr; grid-template-rows: 1fr; align-items: center; }
  .reader-slider-wrap { min-height: 170px; }
  .reader-position-slider { width: 150px; }
  .host-mirror-meta { align-items: flex-start; flex-direction: column; gap: 3px; }
}

/* Account access */
.auth-body { min-height: 100vh; background: #eef2ef; }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr); }
.auth-intro { display: flex; min-height: 100vh; flex-direction: column; justify-content: center; padding: 8vw; color: #f7faf8; background: #163c32; }
.auth-brand { width: 52px; height: 52px; margin-bottom: 34px; font-size: 24px; }
.auth-intro .eyebrow { margin: 0 0 12px; color: #b9d0c8; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.auth-intro h1 { max-width: 560px; margin: 0 0 20px; font-size: 42px; line-height: 1.18; letter-spacing: 0; }
.auth-intro > p:last-child { max-width: 520px; margin: 0; color: #d7e3de; font-size: 16px; line-height: 1.8; }
.auth-panel { align-self: center; width: min(440px, calc(100% - 48px)); margin: 48px auto; padding: 30px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); box-shadow: 0 18px 50px rgba(30, 48, 41, 0.12); }
.auth-heading { margin-bottom: 24px; }
.auth-heading > span { color: var(--green); font-size: 12px; font-weight: 700; }
.auth-heading h2 { margin: 6px 0 8px; font-size: 24px; }
.auth-heading p { margin: 0; color: var(--muted); line-height: 1.6; }
.auth-form { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; min-width: 0; color: var(--ink); font-size: 13px; font-weight: 650; }
.field small { color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.5; }
.check-row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 500; }
.check-row input { width: 16px; height: 16px; accent-color: var(--green); }
.auth-submit { width: 100%; min-height: 42px; justify-content: center; }
.auth-logout { width: 100%; justify-content: center; }
.form-message { min-height: 20px; margin-top: 14px; color: var(--danger); font-size: 13px; line-height: 1.5; }
.form-message.success { color: var(--green); }

.account-main { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 28px 0 56px; }
.account-create { padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.account-create-form { display: grid; grid-template-columns: minmax(150px, 0.8fr) minmax(180px, 1fr) minmax(140px, 0.7fr) minmax(210px, 1.2fr) auto auto; align-items: end; gap: 14px; }
.account-create-form .check-row { align-self: center; padding-top: 22px; white-space: nowrap; }
.account-list-section { padding-top: 28px; }
.account-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.account-list-heading h2 { margin: 0 0 4px; font-size: 18px; }
.account-list-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.account-list { border-top: 1px solid var(--line); }
.account-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.4fr) minmax(220px, 1fr) auto; align-items: center; gap: 18px; min-height: 78px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.account-identity, .account-meta, .account-state, .account-actions { display: flex; min-width: 0; }
.account-identity { flex-direction: column; gap: 4px; }
.account-identity strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.account-identity span, .account-meta { color: var(--muted); font-size: 12px; }
.account-meta { flex-direction: column; gap: 6px; }
.account-state, .account-actions { align-items: center; flex-wrap: wrap; gap: 8px; }
.account-actions { justify-content: flex-end; }
.account-reset-form { width: min(520px, calc(100vw - 32px)); }

@media (max-width: 980px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-intro { min-height: auto; padding: 38px 24px; }
  .auth-brand { margin-bottom: 20px; }
  .auth-intro h1 { font-size: 30px; }
  .auth-panel { margin: 28px auto 48px; }
  .account-create-form { grid-template-columns: 1fr 1fr; }
  .account-create-form .check-row { padding-top: 0; }
  .account-row { grid-template-columns: 1fr 1fr; }
  .account-actions { justify-content: flex-start; }
}

@media (max-width: 620px) {
  .auth-panel { width: calc(100% - 28px); padding: 22px; }
  .account-main { width: calc(100% - 28px); }
  .account-create-form, .account-row { grid-template-columns: 1fr; }
  .account-row { gap: 10px; }
}

@media (max-width: 1180px) {
  .app-main { padding: 16px; }
  .review-layout { grid-template-columns: 240px minmax(400px, 1fr); }
  .review-facts { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  .review-facts-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; }
  .rundown-layout { grid-template-columns: 1fr; }
  .candidate-list { max-height: 320px; }
  .product-layout { grid-template-columns: 1fr; }
  .detail-drawer { position: static; }
}

@media (max-width: 900px) {
  .app-header { align-items: flex-start; padding: 10px 14px; }
  .brand-block span { max-width: 260px; }
  .workflow-nav { padding: 0 10px; }
  .control-layout { grid-template-columns: 1fr; }
  .control-status { grid-template-columns: 1fr 1fr; }
  .event-row { grid-template-columns: 1fr auto; }
  .event-row-stats { grid-column: 1 / -1; grid-row: 2; }
  .review-layout { grid-template-columns: 1fr; }
  .review-list { border-right: 0; border-bottom: 1px solid var(--line); }
  .review-items { max-height: 240px; }
  .script-risk-action, .ignored-risk-panel { align-items: stretch; flex-direction: column; }
  .ignored-risk-list { justify-content: flex-start; }
  .review-facts { grid-column: auto; }
  .review-facts-body { display: block; }
  .host-current { flex-direction: column; gap: 12px; overflow-y: auto; }
  .host-resizer { display: none; }
  .host-product, .host-script, .host-sidebar { width: 100%; flex: 0 0 auto; }
  .host-product { min-height: 0; border-right: 0; border-bottom: 1px solid #33445b; }
  .host-script { min-height: 520px; }
  .host-sidebar { min-height: 420px; }
  .host-image-frame { max-height: 280px; }
}

@media (max-width: 620px) {
  .app-header { display: block; }
  .header-actions { margin-top: 10px; justify-content: flex-start; }
  .nav-tab { min-width: 126px; }
  .nav-tab.nav-utility { margin-left: 0; }
  .batch-generation-progress { grid-template-columns: 1fr; }
  .batch-generation-head, .batch-generation-meta { align-items: flex-start; flex-direction: column; gap: 8px; }
  .batch-generation-track, .batch-generation-count { width: 100%; }
  .batch-generation-meta span { white-space: normal; }
  .batch-generation-meta small { width: 100%; margin-left: 0; overflow: visible; text-overflow: clip; white-space: normal; }
  .page-heading { display: block; }
  .page-heading .button { margin-top: 10px; }
  .facts-grid { grid-template-columns: 1fr; }
  .rundown-row { grid-template-columns: 42px minmax(0, 1fr); }
  .rundown-row > :nth-child(3), .rundown-row > :nth-child(4) { grid-column: 2; }
  .control-status { grid-template-columns: 1fr; }
  .event-row { grid-template-columns: 1fr; }
  .event-row-stats { grid-column: auto; grid-row: auto; align-items: flex-start; flex-direction: column; gap: 5px; }
  .host-toolbar { height: auto; min-height: 48px; flex-wrap: wrap; }
  .host-page { grid-template-rows: auto minmax(0, 1fr); }
  .host-product { padding: 18px; }
  .host-product h1 { font-size: 30px; }
  .host-facts { grid-template-columns: 1fr; }
  .host-variant { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .host-product-extra .host-variant-value { font-size: 28px; }
  .host-script { padding: 20px; }
  .host-strategy-content { font-size: 28px; }
  .host-script-text { --rich-base-size: 28px; }
}
