:root {
  --bg: #eef1f4;
  --panel: #ffffff;
  --ink: #182230;
  --muted: #64707c;
  --line: #d9e0e6;
  --line-strong: #b9c3cc;
  --accent: #0f766e;
  --accent-strong: #0b5d57;
  --accent-soft: #e4f3f1;
  --sky: #0284c7;
  --sky-soft: #e5f2fb;
  --amber: #d97706;
  --amber-soft: #fff3e0;
  --red: #dc2626;
  --red-soft: #fdecec;
  --green: #16a34a;
  --green-soft: #e7f6ec;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 24px rgba(16, 24, 40, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}


button,
select,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.28);
}

.brand-mark svg {
  width: 20px;
  height: 20px;
}

.brand-copy h1 {
  margin: 0;
  font-size: 17px;
  line-height: 1.15;
}

.brand-copy p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.engine-pill {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: #fff;
  font-size: 12px;
  color: var(--muted);
  max-width: 44vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-soft);
}

.dot.ok {
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.ghost-btn {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.ghost-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: #f8fafb;
}

.ghost-btn svg {
  width: 15px;
  height: 15px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(380px, 1fr);
  gap: 16px;
  padding: 16px;
  min-height: calc(100vh - 60px);
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(100vh - 92px);
  overflow-y: auto;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.jobs-panel {
  flex: 1;
  min-height: 360px;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.control-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.block-head,
.sub-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.block-head svg,
.sub-head svg {
  width: 15px;
  height: 15px;
}

.sub-head {
  margin-top: 16px;
  margin-bottom: 9px;
  text-transform: none;
  color: var(--ink);
  font-size: 13px;
}

.hint {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.55;
  color: var(--muted);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: #e9edf0;
  border-radius: var(--radius);
}

.segmented-three {
  grid-template-columns: repeat(3, 1fr);
}

/* 2x2 正方形操作区 */
.segmented-four {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.segmented-four button {
  height: 44px;
  flex-direction: column;
  gap: 3px;
}

.segmented-four button svg {
  width: 17px;
  height: 17px;
}

.segmented button {
  height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.segmented button svg {
  width: 15px;
  height: 15px;
}

.segmented button.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12);
  font-weight: 600;
}

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 150px;
  margin-top: 10px;
  padding: 16px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.drop-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #eef1f4;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.dropzone:hover .drop-icon,
.dropzone.dragover .drop-icon {
  background: #d3eae7;
  color: var(--accent);
}

.drop-icon svg {
  width: 20px;
  height: 20px;
}

.drop-main {
  max-width: 100%;
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.drop-sub {
  max-width: 100%;
  font-size: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.hidden {
  display: none !important;
}

.url-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.url-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.url-field svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--muted);
}

.url-field input {
  width: 100%;
  height: 40px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}

.folder-pane {
  margin-top: 10px;
}

.folder-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.folder-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.folder-row > svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--muted);
}

.folder-row input {
  flex: 1;
  min-width: 0;
  height: 38px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}

.small-btn {
  height: 30px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.small-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.small-btn svg {
  width: 14px;
  height: 14px;
}

.clear-input-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  padding: 0;
  flex-shrink: 0;
  transition: color .15s, background .15s;
}

.clear-input-btn:hover {
  color: var(--danger, #ef4444);
  background: rgba(239,68,68,.12);
}

.clear-input-btn svg {
  width: 14px;
  height: 14px;
}

.folder-results {
  padding: 14px 16px 16px;
}

.folder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.folder-head h3 {
  margin: 0;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.folder-head h3 svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.folder-path {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.folder-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.folder-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
}

.folder-item:hover {
  border-color: var(--line-strong);
}

.folder-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.folder-item-main {
  min-width: 0;
}

.folder-item-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-item-sub {
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
}

.folder-status.complete {
  background: var(--green-soft);
  color: var(--green);
}

.folder-status.missing {
  background: var(--amber-soft);
  color: var(--amber);
}

.folder-status.master {
  background: var(--sky-soft);
  color: var(--sky);
}

.folder-status.empty {
  background: #eef1f4;
  color: var(--muted);
}

.format-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.format-chip {
  height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.format-chip:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.format-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.chip-ext {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.chip-type {
  font-size: 10px;
  color: var(--muted);
}

.format-chip.active .chip-type {
  color: var(--accent);
}

/* format detail tooltip */
.format-tip {
  position: fixed;
  z-index: 9999;
  max-width: 240px;
  padding: 8px 12px;
  border-radius: 6px;
  background: #1f2937;
  color: #e5e7eb;
  font-size: 11px;
  line-height: 1.55;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 0);
  transition: opacity 0.15s ease;
  white-space: normal;
}

.format-tip.show {
  opacity: 1;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field {
  min-width: 0;
}

.field label,
.crf-label label {
  display: block;
  margin-bottom: 5px;
  font-size: 11px;
  color: var(--muted);
}

select {
  width: 100%;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

select:disabled {
  background: #f1f3f5;
  color: #98a2ab;
}

.crf-field {
  margin-top: 12px;
}

.check-field {
  margin-top: 12px;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.check-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.url-cookie-label {
  margin-top: 8px;
  color: var(--muted);
}

/* URL multi-entry selection panel */
.url-entries-panel {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
}

.url-entries-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: #f7f9fb;
}

.url-entries-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.url-entries-title svg {
  width: 15px;
  height: 15px;
  color: var(--muted);
}

.url-entries-list {
  max-height: 280px;
  overflow-y: auto;
}

.url-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid #f0f3f5;
  cursor: pointer;
  transition: background 0.1s;
}

.url-entry:last-child {
  border-bottom: none;
}

.url-entry:hover {
  background: #f7f9fb;
}

.ue-check {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.ue-thumb {
  flex: 0 0 52px;
  height: 36px;
  border-radius: 4px;
  overflow: hidden;
  background: #eef1f4;
  display: grid;
  place-items: center;
}

.ue-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ue-thumb svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.ue-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ue-title {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ue-meta {
  font-size: 10px;
  color: var(--muted);
}

.ue-desc {
  font-size: 10px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cookie-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fafbfc;
}

.cookie-status {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.cookie-status.configured {
  color: var(--accent);
}

.cookie-status svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

.cookie-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.cookie-row .small-btn {
  height: 28px;
}

.icon-only {
  width: 30px;
  padding: 0;
  justify-content: center;
}

.crf-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.crf-label label {
  margin: 0;
}

#crfValue {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.primary {
  width: 100%;
  height: 46px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.25);
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.primary:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.primary:active {
  transform: translateY(0);
}

.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.primary svg {
  width: 17px;
  height: 17px;
}

.tips-box {
  padding: 12px 14px;
  border: 1px solid #dce8e6;
  border-radius: var(--radius);
  background: #f3faf9;
}

.tips-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.tips-title svg {
  width: 15px;
  height: 15px;
}

.tips-box ul {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 11px;
  line-height: 1.8;
  color: var(--muted);
}

.meta-chip {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 99px;
  background: #eef1f4;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
}

.meta-chip.accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.jobs-panel {
  display: flex;
  flex-direction: column;
}

.panel-head {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.head-title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.head-title > svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.head-title h2 {
  margin: 0;
  font-size: 15px;
}

.count {
  min-width: 22px;
  padding: 2px 8px;
  border-radius: 99px;
  background: #e9edf0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.head-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-pills {
  display: flex;
  gap: 6px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  background: #eef1f4;
  color: var(--muted);
}

.stat-pill.active {
  background: var(--amber-soft);
  color: var(--amber);
}

.stat-pill.done {
  background: var(--green-soft);
  color: var(--green);
}

.stat-pill.error {
  background: var(--red-soft);
  color: var(--red);
}

.job-list {
  min-height: 260px;
  padding: 14px 16px 18px;
  overflow-y: auto;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 240px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.empty svg {
  width: 42px;
  height: 42px;
  margin-bottom: 8px;
  opacity: 0.6;
}

.job {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.job:hover {
  border-color: var(--line-strong);
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.07);
}

.job.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.job-thumb {
  position: relative;
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #eef1f4;
  color: var(--muted);
  overflow: hidden;
}

.job-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.job-thumb svg {
  width: 26px;
  height: 26px;
}

.job-hover-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 2;
  background: #000;
}

.job:hover .job-hover-video {
  opacity: 1;
}

.job-main {
  min-width: 0;
}

.job-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.job-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
}

.pill.queued,
.pill.probing,
.pill.converting {
  background: var(--amber-soft);
  color: var(--amber);
}

.pill.done {
  background: var(--green-soft);
  color: var(--green);
}

.pill.error {
  background: var(--red-soft);
  color: var(--red);
}

.job-sub {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-path {
  margin-top: 4px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-meta {
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.job-meta span {
  padding: 2px 7px;
  border-radius: 99px;
  background: #f1f3f5;
  color: var(--muted);
  font-size: 10px;
}

.job-error {
  margin-top: 7px;
  padding: 7px 9px;
  border-radius: 6px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 11px;
  overflow-wrap: anywhere;
  max-height: 76px;
  overflow-y: auto;
}

.progress {
  height: 7px;
  margin-top: 8px;
  border-radius: 4px;
  background: #e7ebee;
  overflow: hidden;
}

.progress i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), #14b8a6);
  background-size: 200% 100%;
  animation: progress-shift 1.4s linear infinite;
  transition: width 0.3s ease;
}

@keyframes progress-shift {
  from {
    background-position: 0 0;
  }
  to {
    background-position: -200% 0;
  }
}

.job-actions {
  display: flex;
  gap: 7px;
  align-items: center;
}

.icon-btn {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.icon-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: #f8fafb;
}

.icon-btn.download {
  color: var(--accent);
  border-color: #c7e4e1;
  background: var(--accent-soft);
}

.icon-btn.download:hover {
  background: #d3ecea;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 50;
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: var(--radius);
  background: #182230;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.28);
}

@media (max-width: 1020px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    max-height: none;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 0 14px;
  }

  .top-actions .ghost-btn span {
    display: none;
  }

  .top-actions .ghost-btn {
    width: 34px;
    padding: 0;
    justify-content: center;
  }

  .engine-pill {
    max-width: 38vw;
  }

  .workspace {
    padding: 10px;
    gap: 10px;
  }

  .field-grid {
    grid-template-columns: 1fr 1fr;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .head-tools {
    width: 100%;
    justify-content: space-between;
  }

  .job {
    grid-template-columns: 62px minmax(0, 1fr);
  }

  .job-thumb {
    width: 62px;
    height: 62px;
  }

  .job-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .stat-pills {
    flex-wrap: wrap;
  }
}


/* ============================================================
   Desktop mode — frameless window integration
   ============================================================ */

/* -- Drag region: brand + the empty middle strip act as the titlebar ---- */
.desktop-mode .topbar {
  -webkit-app-region: no-drag;
}

.desktop-mode .brand.pywebview-drag-region,
.desktop-mode .topbar-drag-spacer {
  -webkit-app-region: drag;
  user-select: none;
}

.topbar-drag-spacer {
  flex: 1 1 auto;
  align-self: stretch;
  min-width: 32px;
  margin: 0 12px;
}

.desktop-mode .topbar button,
.desktop-mode .topbar input,
.desktop-mode .topbar select,
.desktop-mode .topbar .engine-pill {
  -webkit-app-region: no-drag;
}

/* -- Window control buttons --------------------------------- */
.win-ctrl {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: 6px;
  -webkit-app-region: no-drag;
}

.win-btn {
  width: 40px;
  height: 34px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.win-btn:hover {
  background: #eef1f4;
  color: var(--ink);
}

.win-btn.win-close:hover {
  background: #dc2626;
  color: #fff;
}

.win-btn svg {
  width: 15px;
  height: 15px;
}

/* -- Adjust layout for frameless window --------------------- */
.desktop-mode .workspace {
  height: calc(100vh - 60px);
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

.desktop-mode .sidebar {
  position: static;
  min-height: 0;
  max-height: none;
}

.desktop-mode .content,
.desktop-mode .jobs-panel,
.desktop-mode .job-list {
  min-height: 0;
}

.desktop-mode .jobs-panel {
  height: 100%;
}

.desktop-mode .job-list {
  flex: 1 1 auto;
  min-height: 0;
}

/* A dedicated strip remains above the browser scrollbar, so the right edge is
   always available for resizing even at the minimum window size. */
.resize-handle-right {
  position: fixed;
  top: 6px;
  right: 0;
  bottom: 6px;
  z-index: 1000;
  width: 10px;
  cursor: e-resize;
  -webkit-app-region: no-drag;
  touch-action: none;
}

@media (min-width: 641px) and (max-width: 1020px) {
  /* The desktop window cannot shrink below 960px. Keep its two-column layout
     until that real minimum instead of incorrectly applying the phone layout. */
  .desktop-mode .workspace {
    grid-template-columns: minmax(320px, 360px) minmax(0, 1fr);
  }

  .desktop-mode .sidebar {
    display: flex;
  }
}

/* LUT 预览面板 */
.preview-player-wrap {
  margin-top: 8px;
  border-radius: var(--radius);
  overflow: hidden;
  background: #0d1117;
  box-shadow: var(--shadow);
}

.preview-player-wrap video {
  display: block;
  width: 100%;
  max-height: 240px;
  background: #0d1117;
}

.preview-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.preview-meta b {
  color: var(--ink);
}

.preview-actions {
  margin-top: 10px;
}

.preview-actions .primary {
  width: 100%;
}

/* ==========================================================================
   深色高级主题 (Dark Pro Theme)
   --------------------------------------------------------------------------
   通过 CSS 变量 + 针对性覆盖实现, 不改变任何 HTML 结构与类名,
   保证既有功能完全不受影响。
   ========================================================================== */
:root {
  /* 基础色板: 深色底 + 薄荷绿强调 (v2 设计规格) */
  --bg: #0D1117;                     /* 页面背景 */
  --panel: #141A22;                  /* 主面板 */
  --panel-2: #1A212B;                /* 次级表面 */
  --ink: #F2F5F8;                    /* 主文字 */
  --muted: #A1ACBA;                  /* 次文字 */
  --line: #293340;                   /* 边框/分隔线 */
  --line-strong: #39445A;            /* 强分隔线 */
  --accent: #5DD6C1;                 /* 品牌强调(薄荷绿) */
  --accent-strong: #41BBA7;          /* 强调深 */
  --accent-soft: rgba(93, 214, 193, 0.12);
  --sky: #38bdf8;                    /* 辅助蓝 */
  --sky-soft: rgba(56, 189, 248, 0.12);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.14);
  --red: #FF6B72;                    /* 失败色 */
  --red-soft: rgba(255, 107, 114, 0.14);
  --green: #59C97A;                  /* 成功色 */
  --green-soft: rgba(89, 201, 122, 0.14);
  --weak: #687586;                   /* 弱文字 */
  --radius: 10px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.25);
  --glow-accent: 0 0 0 1px rgba(93, 214, 193, 0.25), 0 0 18px rgba(93, 214, 193, 0.12);
}

/* ---- 全局底色与渐变背景 ---- */
body {
  background: var(--bg);
  color: var(--ink);
}

/* ---- 顶部栏: 深色 + 渐变分隔 ---- */
.topbar {
  background: linear-gradient(180deg, #151a22 0%, #11161d 100%);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(45, 212, 191, 0.06);
}

/* ---- 品牌文字 ---- */
.brand-copy h1 {
  background: linear-gradient(90deg, #5eead4, #38bdf8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.5px;
}
.brand-copy p {
  color: var(--muted);
}

/* ---- 侧栏 / 内容区 ---- */
.sidebar {
  background: var(--bg);
  border-right: 1px solid var(--line);
}
.content {
  background: var(--bg);
}

/* ---- 面板卡片 ---- */
.jobs-panel,
.control-block,
.folder-results {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* ---- 分区标题 ---- */
.block-head,
.sub-head {
  color: var(--ink);
}

/* ---- 输入类: 统一深色底 ---- */
.url-field,
.folder-row,
.folder-path,
.format-tip {
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.url-field input,
.folder-row input,
.folder-path input,
.folder-item input,
#outputDirInput {
  color: var(--ink);
  background: transparent;
}
.url-field:focus-within,
.folder-row:focus-within {
  border-color: var(--accent);
  box-shadow: var(--glow-accent);
}
.url-field input::placeholder,
.folder-row input::placeholder {
  color: #5c6879;
}

/* ---- 分段按钮(操作/来源切换) ---- */
.segmented {
  background: #10151c;
  border: 1px solid var(--line);
}
.segmented button {
  color: var(--muted);
}
.segmented button.active {
  background: linear-gradient(180deg, #232c39, #1b222c);
  color: #eaf6f4;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  border: 1px solid #33404f;
}
.segmented button.active svg {
  color: var(--accent);
}

/* ---- 上传拖放区 ---- */
.dropzone {
  background: var(--panel-2);
  border: 1.5px dashed #33404f;
}
.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.drop-icon {
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.18), rgba(56, 189, 248, 0.14));
}
.drop-icon svg {
  color: var(--accent);
}
.drop-sub {
  color: var(--muted);
}

/* ---- 按钮体系 ---- */
.primary {
  background: linear-gradient(180deg, #16b8a6, #0e9488);
  border: 1px solid rgba(45, 212, 191, 0.35);
  box-shadow: 0 2px 10px rgba(20, 184, 166, 0.25);
  color: #062a26;
  font-weight: 600;
}
.primary:hover {
  background: linear-gradient(180deg, #1cc9b4, #12a99a);
  box-shadow: 0 4px 16px rgba(20, 184, 166, 0.35);
}
.primary:active {
  transform: translateY(1px);
}
.primary svg {
  color: #062a26;
}

.ghost-btn,
.small-btn,
.win-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}
.ghost-btn:hover,
.small-btn:hover,
.win-btn:hover {
  background: var(--panel-2);
  border-color: var(--line-strong);
  color: var(--ink);
}
.win-close:hover {
  background: #dc2626;
  color: #fff;
}
.clear-input-btn {
  background: transparent;
  color: var(--muted);
}
.clear-input-btn:hover {
  color: var(--red);
}

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
}
.icon-btn:hover {
  background: var(--panel-2);
  border-color: var(--line);
  color: var(--ink);
}
.icon-btn.download:hover {
  color: var(--accent);
}
.icon-btn.retry:hover {
  color: var(--amber);
}

/* ---- 格式网格/档位 chips ---- */
.format-grid {
  gap: 6px;
}
.format-chip {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
}
.format-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.format-chip.active {
  background: linear-gradient(180deg, rgba(45, 212, 191, 0.22), rgba(45, 212, 191, 0.10));
  border-color: var(--accent);
  box-shadow: var(--glow-accent);
}
.format-chip.active .chip-ext {
  color: #5eead4;
}
.format-chip .chip-type {
  color: var(--muted);
}

/* ---- 滑块 ---- */
input[type="range"] {
  accent-color: var(--accent);
}

/* ---- 下拉框/复选框 ---- */
select,
input[type="text"],
input[type="url"] {
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--line);
}
select:focus {
  border-color: var(--accent);
  outline: none;
}
.check-label input[type="checkbox"] {
  accent-color: var(--accent);
}

/* ---- 任务卡片 ---- */
.job {
  background: var(--panel-2);
  border: 1px solid var(--line);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.job:hover {
  border-color: var(--line-strong);
}
.job.selected {
  border-color: var(--accent);
  box-shadow: var(--glow-accent);
}
.job-name {
  color: var(--ink);
}
.job-sub,
.job-path,
.job-meta {
  color: var(--muted);
}
.job-meta span {
  background: #10151c;
  border: 1px solid var(--line);
  color: var(--muted);
}
.pill {
  background: #10151c;
  border: 1px solid var(--line);
  color: var(--muted);
}
.pill.probing,
.pill.downloading,
.pill.converting,
.pill.queued {
  border-color: rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
}
.pill.done {
  border-color: rgba(74, 222, 128, 0.4);
  color: #86efac;
}
.pill.error {
  border-color: rgba(248, 113, 113, 0.4);
  color: #fca5a5;
}

/* ---- 进度条 ---- */
.progress {
  background: #10151c;
  border: 1px solid var(--line);
}
.progress i {
  background: linear-gradient(90deg, #2dd4bf, #38bdf8);
  box-shadow: 0 0 8px rgba(45, 212, 191, 0.4);
}

/* ---- 统计 pills ---- */
.stat-pill {
  background: #10151c;
  border: 1px solid var(--line);
  color: var(--muted);
}
.stat-pill.active {
  border-color: rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
}
.stat-pill.done {
  border-color: rgba(74, 222, 128, 0.35);
  color: #86efac;
}
.stat-pill.error {
  border-color: rgba(248, 113, 113, 0.35);
  color: #fca5a5;
}

/* ---- 引擎状态点 ---- */
.dot {
  background: #6b7280;
}
.dot.ok {
  background: var(--green);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

/* ---- 提示框 ---- */
.hint {
  color: var(--muted);
}
.tips-box {
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.tips-title {
  color: var(--ink);
}

/* ---- 空状态 ---- */
.empty {
  color: var(--muted);
}
.empty svg {
  color: #4b5563;
}

/* ---- Toast ---- */
.toast {
  background: #1c232e;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}

/* ---- 预览播放器 ---- */
.preview-player-wrap {
  background: #000;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* ---- URL 条目 / 文件夹条目 ---- */
.url-entry,
.folder-item {
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.url-entry:hover,
.folder-item:hover {
  border-color: var(--line-strong);
  background: #202834;
}
.ue-title,
.folder-item-name {
  color: var(--ink);
}
.ue-meta,
.folder-item-sub {
  color: var(--muted);
}
.url-entries-head {
  border-bottom: 1px solid var(--line);
}

/* ---- 滚动条(深色) ---- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #2a3542;
  border-radius: 5px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: #3a4757;
}

/* ---- 顶层提示气泡 ---- */
.format-tip {
  color: var(--ink);
  box-shadow: var(--shadow);
}

/* ---- 深色主题遗漏补充 ---- */
.cookie-row {
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.cookie-status.configured {
  color: #5eead4;
}
select:disabled {
  background: #1a212b;
  color: #5c6879;
}
.cookie-row .small-btn {
  background: #1a212b;
  border: 1px solid var(--line);
}
.cookie-row .small-btn:hover {
  background: #232c39;
  border-color: var(--accent);
}
.engine-pill {
  background: var(--panel-2);
  border: 1px solid var(--line);
}

/* ---- 下拉框高级化 --- */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 30px 0 12px;
  height: 38px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  /* 自定义下拉箭头: 精致小三角 */
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a95a6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
select:hover {
  border-color: var(--line-strong);
  background-color: #202a37;
}
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.15);
  background-color: #202a37;
  outline: none;
}

/* 下拉展开的选项列表 */
select option {
  background: #1a212b;
  color: var(--ink);
  padding: 8px 10px;
  font-size: 13px;
}
select option:hover,
select option:focus {
  background: rgba(45, 212, 191, 0.16);
  color: #eaf6f4;
}
select option:checked {
  background: rgba(45, 212, 191, 0.22);
  color: #5eead4;
  font-weight: 600;
}

/* 选项分组标题 */
select optgroup {
  background: #1a212b;
  color: var(--muted);
  font-style: normal;
  font-weight: 600;
}
select optgroup option {
  padding-left: 18px;
}
.count {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
}
.folder-status.empty {
  background: var(--panel-2);
}
.ue-thumb {
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.meta-chip {
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.job-thumb {
  background: var(--panel-2);
}
.win-btn:hover {
  background: var(--panel-2) !important;
}
.url-entries-panel {
  background: var(--panel);
  border: 1px solid var(--line);
}
.folder-path input,
.folder-item input[type="checkbox"] {
  accent-color: var(--accent);
}

/* ==========================================================================
   V2 视觉整改: 三层表面 + 减边框 + 新组件 (评审第一轮 5 项)
   ========================================================================== */
/* --- 三层表面: 页面背景 / 左右主面板 / 输入框或局部浮层 --- */
.sidebar {
  padding: 18px 20px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.content {
  padding: 18px 20px 18px 0;
  overflow: auto;
}
.control-block {
  background: transparent;
  border: none;
  box-shadow: none;
  margin: 0;
  padding: 14px 0;
  border-top: 1px solid rgba(41, 51, 64, 0.35);
}
.control-block:first-child {
  border-top: none;
  padding-top: 0;
}
.jobs-panel,
.folder-results {
  border-radius: 12px;
}
/* 分组标题: 面板标题16 / 分组标题14 */
.block-head {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
}
.sub-head {
  font-size: 14px;
  font-weight: 600;
  color: var(--weak);
  margin-top: 16px;
}
.hint {
  font-size: 12px;
}
/* 字段不再各自成卡: 去描边, 用间距区分 */
.field,
.check-field,
.field-grid > .field {
  background: transparent;
  border: none;
  box-shadow: none;
}
/* 主按钮: 纯色无发光, 固定在侧栏底部 */
.primary {
  background: var(--accent);
  color: #0b1714;
  border: none;
  box-shadow: none;
  height: 44px;
  border-radius: 12px;
  margin-top: auto;
  width: 100%;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.primary:hover {
  background: #6fe0cd;
}
.primary:disabled {
  background: var(--panel-2);
  color: var(--weak);
  cursor: not-allowed;
}
#runHint {
  margin-top: 8px;
  text-align: center;
  color: var(--weak);
}
/* 分段按钮选中态: 去渐变, 薄荷绿描边 */
.segmented {
  background: #0b0f14;
}
.segmented button.active {
  background: var(--panel-2);
  color: var(--ink);
  box-shadow: none;
  border-color: var(--accent);
}
/* --- 引擎行: 一行状态 + 详情按钮（全文进诊断弹窗） --- */
.engine-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.engine-row #engineText {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* --- 高级设置(折叠) --- */
.advanced {
  border-top: 1px solid rgba(41, 51, 64, 0.35);
  padding: 12px 0;
}
.advanced summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  list-style: none;
}
.advanced summary::-webkit-details-marker {
  display: none;
}
.advanced[open] summary {
  color: var(--ink);
}
.advanced-body {
  margin-top: 12px;
}
/* --- 登录态管理: 一行状态 + 管理弹层（来源单选 + 操作按钮） --- */
.cookie-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  margin-top: 8px;
}
.cookie-status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  flex: 1;
  min-width: 0;
}
.cookie-status {
  font-size: 12px;
  color: var(--muted);
}
.cookie-status.configured {
  color: var(--green);
}
.cookie-manage {
  position: relative;
  flex-shrink: 0;
}
.cookie-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  width: 250px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 12px;
  box-shadow: var(--shadow);
}
.cookie-menu-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
/* --- 引擎诊断弹窗 --- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 12, 0.66);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  width: min(620px, calc(100vw - 48px));
  max-height: 82vh;
  display: flex;
  flex-direction: column;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}
.modal-body {
  padding: 14px 16px;
  overflow-y: auto;
}
.modal-sec-title {
  font-size: 13px;
  color: var(--weak);
  margin: 10px 0 4px;
}
.modal-pre {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}
.modal-line {
  font-size: 13px;
  color: var(--muted);
}
/* --- 右侧空状态: 推动操作 --- */
.empty-title {
  font-size: 14px;
  color: var(--ink);
  margin-top: 8px;
}
.empty-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
}
/* --- 统计胶囊: 零值灰显; 成功绿/失败红 --- */
.stat-pill.zero {
  color: var(--weak);
  border-color: var(--line);
}
.stat-pill.done {
  background: var(--green-soft) !important;
  color: var(--green) !important;
}
.stat-pill.error {
  background: var(--red-soft) !important;
  color: var(--red) !important;
}
#clearDoneBtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
/* --- 拉伸窗口时的渲染兜底: 背景与页面同色, 避免白边闪烁 --- */
html {
  height: 100%;
  background: #0D1117;
}
body {
  min-width: 100%;
  min-height: 100%;
  background: var(--bg);
}
body.desktop-mode {
  overflow: hidden;
}
.workspace {
  min-width: 100%;
  min-height: 100%;
}

/* ==========================================================================
   V3 信息架构: 三模式来源 + 快速预设/格式抽屉 + 待处理队列 + 固定底栏
   (评审第二轮 9 项; 不改后端, 只重排交互层级)
   ========================================================================== */

/* --- 侧栏: 可滚动设置区 + 固定底栏 --- */
.sidebar {
  padding: 0;
  overflow: hidden;
  gap: 0;
}
.sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px 14px;
  display: flex;
  flex-direction: column;
}
.sidebar-scroll > .control-block + .control-block {
  margin-top: 2px;
}
.sidebar-footer {
  flex: 0 0 auto;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar-footer .primary {
  margin-top: 0;
}
.footer-summary {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  min-height: 18px;
}
.footer-summary svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  color: var(--weak);
}
#runHint {
  margin-top: 0;
  text-align: left;
}

/* --- 来源三模式 --- */
.folder-pick-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.folder-pick-row .small-btn {
  height: 36px;
  padding: 0 14px;
}
.folder-pick-row #folderPathLabel {
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}
.url-field .small-btn {
  height: 30px;
  margin-right: 2px;
  flex: 0 0 auto;
}
#urlScanStatus.error {
  color: var(--red);
}

/* --- 快速预设 --- */
.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.preset-chip {
  position: relative;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.preset-chip:hover {
  border-color: var(--line-strong);
}
.preset-chip.active {
  border-color: var(--line-strong);
  background: var(--accent-soft);
}
.preset-chip.active .preset-label {
  color: var(--accent);
}
.preset-chip[data-preset="more"] {
  grid-column: 1 / -1;
  align-items: center;
  min-height: 42px;
  font-weight: 600;
  color: var(--muted);
  flex-direction: row;
  justify-content: center;
  gap: 7px;
}
.preset-label {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
}
.preset-badge {
  position: absolute;
  top: 5px;
  right: 6px;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 9.5px;
  font-weight: 700;
}

/* --- 更多格式抽屉 (视频/音频/动图分组) --- */
.format-more {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
}
.format-more .sub-head {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--weak);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.format-more .format-group + .format-group {
  margin-top: 14px;
}
.format-more .format-chip {
  border: 1px solid var(--line);
  background: var(--panel);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.format-more .format-chip:hover {
  border-color: var(--line-strong);
  transform: none;
}
.format-more .format-chip.active {
  border-color: var(--line-strong);
  background: var(--accent-soft);
  box-shadow: none;
}
.format-more .format-chip.active .chip-ext {
  color: var(--accent);
}

/* --- 画质/速度小分段 (字段内) --- */
.quality-seg {
  padding: 3px;
  border-radius: 7px;
}
.quality-seg button {
  height: 30px;
  font-size: 11.5px;
  gap: 4px;
}

/* --- 高级参数区 --- */
.advanced-params {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(41, 51, 64, 0.35);
}

/* --- 输出位置: 打开目录入口 --- */
.row-actions {
  display: flex;
  margin-top: 10px;
}
.row-actions .ghost-btn {
  height: 32px;
  font-size: 12px;
}

/* --- 任务队列: 筛选 tabs --- */
.head-tools {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.filter-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.filter-tab {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11.5px;
  transition: background 0.15s ease, color 0.15s ease;
}
.filter-tab:hover {
  color: var(--ink);
}
.filter-tab.active {
  background: var(--panel-2);
  color: var(--ink);
  font-weight: 600;
}

/* --- 待处理行 --- */
.job.pending {
  background: var(--panel-2);
  border-style: dashed;
}
.job.pending:hover {
  border-color: var(--line-strong);
}
.pill.pending {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
}
.icon-btn.pending-start {
  color: var(--accent);
  border-color: var(--line);
}
.icon-btn.pending-start:hover {
  background: var(--accent-soft);
  border-color: var(--line-strong);
}
.stat-pill.pending {
  border-color: var(--line);
  color: var(--muted);
}

/* --- 右侧面板拖放反馈 --- */
.jobs-panel.dragover {
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
}

/* --- 空状态: 图标修正 + 位置下移 + 按钮收敛 --- */
/* 顶栏本就是实心渐变, 关掉 backdrop-filter: WebView2 拉伸重排时这一层
   最容易出现白色闪烁 (V2 只在页面兜底, 这里补窗口级的一层) */
.desktop-mode .topbar {
  backdrop-filter: none;
}
.empty {
  min-height: 100%;
  padding-top: clamp(56px, 15vh, 170px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.empty-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 320px;
}
.empty-hero svg {
  width: 42px;
  height: 42px;
  margin-bottom: 8px;
  opacity: 0.6;
}
.empty-actions .small-btn {
  height: 38px;
  padding: 0 16px;
  gap: 8px;
  border-radius: 8px;
  font-size: 13px;
}
.empty-actions .small-btn svg {
  width: 15px;
  height: 15px;
}
.empty-actions .empty-primary {
  background: var(--accent);
  border-color: transparent;
  color: #0b1714;
  font-weight: 600;
}
.empty-actions .empty-primary:hover {
  background: #6fe0cd;
  color: #0b1714;
}

/* --- 任务面板头部拥挤时换行 --- */
@media (max-width: 1020px) {
  .filter-tabs {
    flex-wrap: wrap;
  }
}

/* --- 桌面全屏态: 禁用右侧缩放把手(原生已由 api 屏蔽, 双保险) --- */
.desktop-mode.is-fullscreen .resize-handle-right {
  display: none;
}
