/* ==========================================================================
   任务发布 v2
   独立模块；纯色、细边框、无投影、无渐变、无背景模糊。
   ========================================================================== */

.pub-page {
  box-sizing: border-box;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  color: var(--text);
}

.pub-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: #fff;
}

.pub-toolbar-main {
  min-width: 0;
}

.pub-toolbar-title {
  margin: 0;
  font-size: var(--fs-xl);
  font-weight: 750;
  line-height: 1.25;
}

.pub-toolbar-scope {
  margin-top: 4px;
  color: var(--text-light);
  font-size: var(--fs-xs);
}

.pub-primary-btn,
.pub-secondary-btn,
.pub-danger-btn,
.pub-icon-btn {
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-weight: 650;
  cursor: pointer;
  transition: background var(--dur-2), border-color var(--dur-2), color var(--dur-2),
              transform var(--dur-1);
}

.pub-primary-btn,
.pub-secondary-btn,
.pub-danger-btn {
  min-height: 42px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  white-space: nowrap;
}

.pub-primary-btn {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.pub-primary-btn:hover {
  border-color: var(--brand-600);
  background: var(--brand-600);
}

.pub-secondary-btn {
  border-color: var(--slate-300);
  background: #fff;
  color: var(--slate-700);
}

.pub-secondary-btn:hover {
  border-color: var(--brand-400);
  color: var(--brand-600);
  background: var(--brand-100);
}

.pub-danger-btn {
  border-color: #fecaca;
  background: #fef2f2;
  color: #dc2626;
}

.pub-danger-btn:hover {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.pub-primary-btn:active,
.pub-secondary-btn:active,
.pub-danger-btn:active,
.pub-icon-btn:active {
  transform: scale(0.97);
}

.pub-primary-btn:disabled,
.pub-secondary-btn:disabled,
.pub-danger-btn:disabled {
  border-color: var(--slate-200);
  background: var(--slate-200);
  color: var(--slate-400);
  cursor: not-allowed;
  transform: none;
}

.pub-primary-btn svg,
.pub-secondary-btn svg,
.pub-danger-btn svg,
.pub-icon-btn svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.pub-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: #fff;
}

.pub-summary-item {
  min-width: 0;
  padding: 16px 18px;
  border-right: 1px solid var(--border);
}

.pub-summary-item:last-child {
  border-right: 0;
}

.pub-summary-value {
  color: var(--text);
  font-family: var(--font-num);
  font-size: 25px;
  font-weight: 750;
  line-height: 1;
}

.pub-summary-item:nth-child(1) .pub-summary-value { color: var(--brand-600); }
.pub-summary-item:nth-child(2) .pub-summary-value { color: #dc2626; }
.pub-summary-item:nth-child(3) .pub-summary-value { color: #0369a1; }
.pub-summary-item:nth-child(4) .pub-summary-value { color: #15803d; }

.pub-summary-label {
  margin-top: 7px;
  color: var(--text-light);
  font-size: var(--fs-xs);
  white-space: nowrap;
}

.pub-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--slate-50);
}

.pub-search {
  position: relative;
  min-width: 0;
}

.pub-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 17px;
  height: 17px;
  color: var(--slate-400);
  transform: translateY(-50%);
  pointer-events: none;
}

.pub-search input,
.pub-filter-select,
.pub-control input,
.pub-control textarea,
.pub-control select,
.pub-builder-card input,
.pub-builder-card textarea {
  width: 100%;
  border: 1px solid var(--slate-300);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color var(--dur-2), background var(--dur-2);
}

.pub-search input {
  height: 42px;
  padding: 0 12px 0 38px;
}

.pub-filter-select {
  height: 42px;
  padding: 0 36px 0 12px;
  cursor: pointer;
}

.pub-search input:focus,
.pub-filter-select:focus,
.pub-control input:focus,
.pub-control textarea:focus,
.pub-control select:focus,
.pub-builder-card input:focus,
.pub-builder-card textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

/* 输入框校验错误态 */
.pub-control input.is-error,
.pub-control textarea.is-error,
.pub-builder-card input.is-error,
.pub-builder-card textarea.is-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}

.pub-field-error {
  margin-top: 4px;
  color: var(--danger);
  font-size: 11px;
  font-weight: 600;
}

/* 字数统计 */
.pub-char-count {
  margin-top: 4px;
  text-align: right;
  color: var(--text-light);
  font-size: 11px;
  font-family: var(--font-num);
}
.pub-char-count.near { color: var(--brand-600); }
.pub-char-count.over { color: var(--danger); }

@keyframes pubShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.pub-shake { animation: pubShake 0.4s ease; }

.pub-segments {
  display: inline-grid;
  grid-template-columns: repeat(4, auto);
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-sm);
  background: #fff;
}

.pub-segment {
  min-height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-light);
  font-family: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.pub-segment.active {
  background: var(--brand-100);
  color: var(--brand-600);
}

.pub-dept {
  margin-bottom: 22px;
}

.pub-dept-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  margin-bottom: 10px;
  padding: 0 2px;
}

.pub-dept-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pub-dept-icon svg {
  width: 16px;
  height: 16px;
}

.pub-dept-name {
  min-width: 0;
  font-size: 15px;
  font-weight: 750;
}

.pub-dept-count {
  margin-left: auto;
  padding: 3px 8px;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-xs);
  background: var(--slate-50);
  color: var(--text-light);
  font-size: 11px;
  font-weight: 650;
}

.pub-list-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.pub-task {
  position: relative;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--slate-200);
  border-left: 4px solid var(--brand);
  border-radius: var(--r-md);
  background: #fff;
  animation: pubCardIn var(--dur-3) var(--ease-out) both;
}

.pub-task[data-type="study"] { border-left-color: #0ea5e9; }
.pub-task[data-type="exam"] { border-left-color: #ef4444; }
.pub-task.is-urgent { background: #fffafa; }

@keyframes pubCardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.pub-task-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.pub-task-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 750;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.pub-task-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.pub-tag {
  padding: 3px 7px;
  border-radius: var(--r-xs);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.pub-tag.form { background: var(--brand-100); color: #c2410c; }
.pub-tag.study { background: #e0f2fe; color: #0369a1; }
.pub-tag.exam { background: #fee2e2; color: #b91c1c; }
.pub-tag.urgent { background: #ef4444; color: #fff; }

.pub-task-desc {
  display: -webkit-box;
  min-height: 38px;
  margin: 9px 0;
  overflow: hidden;
  color: var(--text-light);
  font-size: 12px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.pub-task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-bottom: 13px;
  color: var(--slate-500);
  font-size: 11px;
}

.pub-progress-block {
  padding: 10px;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-sm);
  background: var(--slate-50);
}

.pub-progress-row + .pub-progress-row {
  margin-top: 8px;
}

.pub-progress-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  color: var(--text-light);
  font-size: 11px;
}

.pub-progress-label b {
  color: var(--text);
  font-family: var(--font-num);
  font-weight: 700;
}

.pub-progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--slate-200);
}

.pub-progress-fill {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: #0ea5e9;
}

.pub-progress-fill.done { background: #22c55e; }
.pub-progress-fill.failed { background: #ef4444; }

.pub-task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.pub-task-actions .pub-secondary-btn,
.pub-task-actions .pub-danger-btn {
  min-height: 34px;
  padding: 0 10px;
  font-size: 11px;
}

.pub-empty,
.pub-error {
  min-height: 260px;
  padding: 48px 20px;
  border: 1px dashed var(--slate-300);
  border-radius: var(--r-md);
  background: var(--slate-50);
  color: var(--text-light);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.pub-empty svg,
.pub-error svg {
  width: 34px;
  height: 34px;
  color: var(--slate-400);
}

.pub-empty p,
.pub-error p {
  margin: 0;
  font-size: 13px;
}

/* 弹层 */
.pub-mask {
  position: fixed;
  inset: 0;
  z-index: 12000;
  padding: 20px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pub-mask.show {
  opacity: 1;
  pointer-events: auto;
}

.pub-modal {
  width: min(760px, 100%);
  max-height: min(88vh, 900px);
  overflow: hidden;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-xl);
  background: #fff;
  box-shadow: var(--elev-4);
  transform: translateY(16px) scale(0.96);
  opacity: 0;
  transition: transform var(--dur-3) var(--ease-spring), opacity var(--dur-3);
  display: flex;
  flex-direction: column;
}

.pub-mask.show .pub-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.pub-modal.small { width: min(520px, 100%); }
.pub-modal.large { width: min(940px, 100%); }

/* 拖动指示条（移动端 sheet） */
.pub-sheet-handle {
  display: none;
  width: 36px;
  height: 4px;
  margin: 10px auto 0;
  border-radius: 2px;
  background: var(--slate-300);
}

.pub-modal-head {
  flex: 0 0 auto;
  min-height: 66px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--slate-100);
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 头部类型色条 */
.pub-head-accent {
  flex: 0 0 auto;
  width: 4px;
  height: 28px;
  border-radius: 2px;
  background: var(--brand);
}
.pub-head-accent.study { background: var(--accent); }
.pub-head-accent.exam { background: var(--danger); }

.pub-modal-heading {
  flex: 1;
  min-width: 0;
}

.pub-modal-title {
  color: var(--text);
  font-size: var(--fs-lg);
  font-weight: 750;
  line-height: 1.3;
}

.pub-modal-sub {
  margin-top: 3px;
  color: var(--text-light);
  font-size: var(--fs-xs);
}

.pub-icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-color: var(--slate-200);
  background: var(--slate-50);
  color: var(--text-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-2), border-color var(--dur-2), color var(--dur-2);
}

.pub-icon-btn:hover {
  border-color: var(--slate-300);
  background: var(--slate-100);
  color: var(--text);
}

.pub-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
}

.pub-modal-foot {
  flex: 0 0 auto;
  padding: 12px 16px;
  border-top: 1px solid var(--slate-100);
  background: var(--slate-50);
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

/* ============ Hero 区（编辑器顶部类型渐变条） ============ */
.pub-hero {
  margin: -18px -18px 16px;
  padding: 18px 20px 16px;
  background: linear-gradient(135deg, var(--brand-100) 0%, #fff 60%);
  border-bottom: 1px solid var(--slate-100);
}
.pub-hero.study {
  background: linear-gradient(135deg, #e0f2fe 0%, #fff 60%);
}
.pub-hero.exam {
  background: linear-gradient(135deg, #fee2e2 0%, #fff 60%);
}
.pub-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--r-full);
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 10px;
}
.pub-hero.study .pub-hero-badge { background: var(--accent); }
.pub-hero.exam .pub-hero-badge { background: var(--danger); }
.pub-hero-badge svg { width: 14px; height: 14px; }
.pub-hero-title {
  width: 100%;
  border: 0;
  border-bottom: 2px solid var(--slate-200);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-xl);
  font-weight: 750;
  padding: 4px 0;
  outline: none;
  transition: border-color var(--dur-2);
}
.pub-hero-title:focus {
  border-bottom-color: var(--brand);
}
.pub-hero.study .pub-hero-title:focus { border-bottom-color: var(--accent); }
.pub-hero.exam .pub-hero-title:focus { border-bottom-color: var(--danger); }

/* ============ 分区卡片 ============ */
.pub-section-card {
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--slate-100);
  border-radius: var(--r-md);
  background: #fff;
  box-shadow: var(--elev-1);
  transition: box-shadow var(--dur-2), transform var(--dur-2);
}
.pub-section-card:hover {
  box-shadow: var(--elev-2);
}
.pub-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.pub-section-title {
  font-size: 14px;
  font-weight: 750;
  color: var(--text);
}
.pub-section-note {
  margin-top: 2px;
  color: var(--text-light);
  font-size: 11px;
}

/* ============ 类型选择弹窗 ============ */
.pub-type-grid {
  display: grid;
  gap: 12px;
}

.pub-type-option {
  width: 100%;
  min-height: 88px;
  padding: 16px;
  border: 1px solid var(--slate-200);
  border-left: 4px solid var(--brand);
  border-radius: var(--r-md);
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  transition: transform var(--dur-2) var(--ease-out), border-color var(--dur-2),
              box-shadow var(--dur-2), background var(--dur-2);
}

.pub-type-option:hover {
  transform: translateY(-2px);
  border-color: var(--brand-400);
  border-left-color: var(--brand);
  box-shadow: var(--elev-3);
  background: var(--brand-50, #fff7ed);
}

.pub-type-option[data-type="study"] { border-left-color: var(--accent); }
.pub-type-option[data-type="study"]:hover { border-color: #38bdf8; border-left-color: var(--accent); background: #f0f9ff; }
.pub-type-option[data-type="exam"] { border-left-color: var(--danger); }
.pub-type-option[data-type="exam"]:hover { border-color: #f87171; border-left-color: var(--danger); background: #fef2f2; }

.pub-type-option:active {
  transform: scale(0.98);
}

.pub-type-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--elev-1);
}

.pub-type-icon.form { background: var(--brand); }
.pub-type-icon.study { background: var(--accent); }
.pub-type-icon.exam { background: var(--danger); }
.pub-type-icon svg { width: 24px; height: 24px; }

.pub-type-name {
  font-size: 15px;
  font-weight: 750;
}

.pub-type-desc {
  margin-top: 4px;
  color: var(--text-light);
  font-size: 12px;
  line-height: 1.45;
}

.pub-type-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  transition: background var(--dur-2);
}
.pub-type-option[data-type="study"] .pub-type-cta { background: var(--accent); }
.pub-type-option[data-type="exam"] .pub-type-cta { background: var(--danger); }
.pub-type-cta svg { width: 14px; height: 14px; }

.pub-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.pub-control {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pub-control.full { grid-column: 1 / -1; }

.pub-control > label,
.pub-label {
  color: var(--slate-600);
  font-size: 12px;
  font-weight: 650;
}

.pub-required {
  margin-left: 2px;
  color: var(--danger);
}

.pub-control input,
.pub-control select {
  height: 42px;
  padding: 0 12px;
}

.pub-control textarea {
  min-height: 84px;
  padding: 10px 12px;
  line-height: 1.55;
  resize: vertical;
}

.pub-switch-row {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-sm);
  background: var(--slate-50);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: background var(--dur-2), border-color var(--dur-2);
}
.pub-switch-row:hover {
  background: var(--slate-100);
}
.pub-switch-row.is-on {
  background: var(--brand-100);
  border-color: var(--brand-400);
}
.pub-switch-row.is-on span {
  color: var(--brand-600);
  font-weight: 650;
}

.pub-switch-row span {
  color: var(--text-light);
  font-size: 12px;
  transition: color var(--dur-2);
}

.pub-switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
}

.pub-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pub-switch-ui {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: var(--slate-300);
  cursor: pointer;
  transition: background var(--dur-2);
}

.pub-switch-ui::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform var(--dur-3) var(--ease-spring);
}

.pub-switch input:checked + .pub-switch-ui {
  background: var(--brand);
}

.pub-switch input:checked + .pub-switch-ui::after {
  transform: translateX(18px);
}

.pub-builder {
  grid-column: 1 / -1;
  padding-top: 4px;
}

.pub-builder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.pub-builder-title {
  font-size: 14px;
  font-weight: 750;
}

.pub-builder-note {
  margin-top: 2px;
  color: var(--text-light);
  font-size: 11px;
}

.pub-add-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}

.pub-add-menu .pub-secondary-btn {
  min-height: 34px;
  padding: 0 10px;
  font-size: 11px;
}

.pub-builder-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pub-builder-empty {
  padding: 32px 18px;
  border: 1px dashed var(--slate-300);
  border-radius: var(--r-md);
  background: var(--slate-50);
  color: var(--text-light);
  font-size: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.pub-builder-empty svg {
  width: 32px;
  height: 32px;
  color: var(--slate-400);
}

/* 新增/删除动画 */
@keyframes pubCardEnter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.pub-builder-card.is-new {
  animation: pubCardEnter var(--dur-3) var(--ease-out) both;
}
@keyframes pubCardPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--brand-glow); }
  50% { box-shadow: 0 0 0 6px transparent; }
}
.pub-builder-card.is-new .pub-builder-index {
  animation: pubCardPulse 0.8s ease;
}

.pub-builder-card {
  position: relative;
  padding: 14px;
  padding-left: 17px;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-md);
  background: #fff;
  box-shadow: var(--elev-1);
  transition: box-shadow var(--dur-2), transform var(--dur-2);
}
.pub-builder-card:hover {
  box-shadow: var(--elev-2);
}

/* 左侧类型色条 */
.pub-builder-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--brand);
}
.pub-builder-card[data-kind="image"]::before { background: var(--accent); }
.pub-builder-card[data-kind="input"]::before { background: #8b5cf6; }
.pub-builder-card[data-kind="image_upload"]::before { background: var(--success); }
.pub-builder-card[data-kind="study"]::before { background: var(--accent); }
.pub-builder-card[data-kind="exam"]::before { background: var(--danger); }

.pub-builder-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.pub-builder-index {
  padding: 3px 9px;
  border-radius: var(--r-full);
  background: var(--brand-100);
  color: var(--brand-600);
  font-size: 11px;
  font-weight: 750;
  font-family: var(--font-num);
}
.pub-builder-card[data-kind="study"] .pub-builder-index { background: #e0f2fe; color: #0369a1; }
.pub-builder-card[data-kind="exam"] .pub-builder-index { background: #fee2e2; color: #b91c1c; }

/* 序号警示态（未设答案） */
.pub-builder-index.is-warning {
  background: #fef3c7;
  color: #b45309;
}

.pub-builder-kind {
  flex: 1;
  color: var(--text-light);
  font-size: 11px;
}

.pub-drag-handle {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--slate-400);
  cursor: grab;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background var(--dur-2), color var(--dur-2);
}
.pub-drag-handle:hover {
  background: var(--slate-100);
  color: var(--text);
}
.pub-drag-handle svg { width: 16px; height: 16px; }
.pub-drag-handle:active { cursor: grabbing; }

.pub-builder-card.is-dragging {
  opacity: 0.5;
  transform: scale(0.99);
  box-shadow: var(--elev-brand);
}

.pub-drop-indicator {
  height: 3px;
  margin: 4px 12px;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--brand), var(--brand-400));
  box-shadow: 0 0 0 3px var(--brand-glow);
  pointer-events: none;
  animation: pub-drop-pulse 0.6s ease-in-out infinite;
}
@keyframes pub-drop-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.pub-builder-card input {
  height: 40px;
  padding: 0 11px;
}

.pub-builder-card textarea {
  min-height: 74px;
  padding: 9px 11px;
  line-height: 1.5;
  resize: vertical;
}

.pub-builder-fields {
  display: grid;
  gap: 8px;
}

/* 卡片间插入按钮 */
.pub-insert-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  margin: -4px 0;
  border: 1px dashed var(--slate-300);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-light);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--dur-2), border-color var(--dur-2), color var(--dur-2);
}
.pub-builder-card:hover + .pub-insert-btn,
.pub-insert-btn:hover {
  opacity: 1;
}
.pub-insert-btn:hover {
  border-color: var(--brand);
  color: var(--brand-600);
  background: var(--brand-50, #fff7ed);
}

/* 底部大号添加按钮 */
.pub-add-bottom-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 46px;
  margin-top: 6px;
  border: 1px solid var(--brand);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--brand-600);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--dur-2), transform var(--dur-1);
}
.pub-add-bottom-btn:hover {
  background: var(--brand-50, #fff7ed);
}
.pub-add-bottom-btn:active {
  transform: scale(0.98);
}
.pub-add-bottom-btn svg { width: 16px; height: 16px; }

/* 移动端悬浮添加按钮 */
.pub-fab-add {
  position: fixed;
  right: 18px;
  bottom: 80px;
  z-index: 12010;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  box-shadow: var(--elev-brand);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--dur-1);
}
.pub-fab-add:active { transform: scale(0.92); }
.pub-fab-add svg { width: 24px; height: 24px; }

/* 字段类型选择 Popover */
.pub-field-popover {
  position: absolute;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-md);
  background: #fff;
  box-shadow: var(--elev-3);
  margin-top: 6px;
}
.pub-field-type {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-sm);
  background: #fff;
  cursor: pointer;
  transition: border-color var(--dur-2), background var(--dur-2);
  min-height: 72px;
}
.pub-field-type:hover {
  border-color: var(--brand);
  background: var(--brand-50, #fff7ed);
}
.pub-field-type svg {
  width: 22px;
  height: 22px;
  color: var(--brand-600);
}
.pub-field-type span {
  font-size: 11px;
  font-weight: 650;
  color: var(--text);
}
.pub-field-type em {
  font-size: 10px;
  color: var(--text-light);
  font-style: normal;
}

.pub-builder-inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pub-checkline {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  background: var(--slate-50);
  color: var(--text-light);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.pub-checkline input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.pub-image-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pub-image-picker input[type="file"] {
  display: none;
}

.pub-upload-btn {
  min-height: 40px;
  padding: 0 14px;
  border: 1px dashed var(--brand-400);
  border-radius: var(--r-sm);
  background: var(--brand-50, #fff7ed);
  color: var(--brand-600);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  align-self: flex-start;
  transition: background var(--dur-2), border-color var(--dur-2);
}
.pub-upload-btn:hover {
  background: var(--brand-100);
  border-color: var(--brand);
}

.pub-upload-btn svg {
  width: 15px;
  height: 15px;
}

.pub-image-preview-wrap {
  position: relative;
  align-self: flex-start;
  border-radius: var(--r-sm);
  overflow: hidden;
}
.pub-image-preview {
  display: block;
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: var(--r-sm);
  background: var(--slate-50);
}

.pub-image-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--dur-2);
}
.pub-image-remove:hover { background: var(--danger); }
.pub-image-remove svg { width: 14px; height: 14px; }

/* 图片上传进度条 */
.pub-upload-progress {
  width: 100%;
  height: 6px;
  border-radius: var(--r-full);
  background: var(--slate-100);
  overflow: hidden;
}
.pub-upload-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-500, #f97316));
  transition: width 0.2s ease;
}
.pub-upload-progress-text {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-light);
  font-family: var(--font-num);
}

.pub-question-type {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-sm);
  background: var(--slate-100);
}

.pub-question-type button {
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-light);
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  transition: background var(--dur-2), color var(--dur-2);
}

.pub-question-type button.active {
  background: var(--brand);
  color: #fff;
}

.pub-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 选项行 — 整行可点击设为正确答案 */
.pub-option-row {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px;
  padding-left: 12px;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--r-sm);
  background: #fff;
  cursor: pointer;
  transition: border-color var(--dur-2), background var(--dur-2);
}
.pub-option-row:hover {
  border-color: var(--slate-300);
}

/* 左侧字母徽章 */
.pub-option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--slate-100);
  color: var(--text-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 750;
  font-family: var(--font-num);
  flex: 0 0 auto;
  transition: background var(--dur-2), color var(--dur-2);
}

.pub-option-row input.pub-option-text {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  font-size: 13px;
  cursor: text;
}
.pub-option-row input.pub-option-text:focus {
  box-shadow: none;
  outline: none;
}

/* 正确答案勾选控件 — 32px 触控区 */
.pub-correct {
  position: relative;
  width: 32px;
  height: 32px;
  margin: 0;
  flex: 0 0 auto;
  cursor: pointer;
}
.pub-correct input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.pub-correct-ui {
  position: absolute;
  inset: 0;
  border: 2px solid var(--slate-300);
  border-radius: 6px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-2), border-color var(--dur-2);
}
.pub-correct-ui svg {
  width: 18px;
  height: 18px;
  color: #fff;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity var(--dur-2), transform var(--dur-2);
}
.pub-correct input:checked + .pub-correct-ui {
  background: var(--success);
  border-color: var(--success);
}
.pub-correct input:checked + .pub-correct-ui svg {
  opacity: 1;
  transform: scale(1);
}

/* 三重视觉强化 — 正确答案 */
.pub-option-row.correct {
  border-color: var(--success);
  background: #f0fdf4;
}
.pub-option-row.correct::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: var(--r-sm) 0 0 var(--r-sm);
  background: var(--success);
}
.pub-option-row.correct .pub-option-letter {
  background: var(--success);
  color: #fff;
}
.pub-option-row.correct .pub-correct-tag {
  display: inline-flex;
}

.pub-correct-tag {
  display: none;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--success);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  grid-column: 1 / -1;
  justify-self: start;
}
.pub-correct-tag svg { width: 11px; height: 11px; }

.pub-option-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pub-opt-del {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--slate-400);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background var(--dur-2), color var(--dur-2);
}
.pub-opt-del:hover {
  background: #fee2e2;
  color: var(--danger);
}
.pub-opt-del svg { width: 15px; height: 15px; }

.pub-options-add {
  align-self: flex-start;
  min-height: 34px;
  padding: 0 12px;
  border: 1px dashed var(--slate-300);
  border-radius: var(--r-sm);
  background: var(--slate-50);
  color: var(--text-light);
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: border-color var(--dur-2), color var(--dur-2);
}
.pub-options-add:hover {
  border-color: var(--brand);
  color: var(--brand-600);
}
.pub-options-add svg { width: 14px; height: 14px; }

.pub-exam-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-md);
  background: var(--slate-50);
}

/* 考试设置步进器 */
.pub-stepper {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-sm);
  background: #fff;
  overflow: hidden;
}
.pub-stepper button {
  height: 38px;
  border: 0;
  background: var(--slate-100);
  color: var(--text);
  font-size: 16px;
  font-weight: 750;
  cursor: pointer;
  transition: background var(--dur-2);
}
.pub-stepper button:hover { background: var(--slate-200); }
.pub-stepper button:active { background: var(--slate-300); }
.pub-stepper input {
  height: 38px;
  border: 0;
  border-left: 1px solid var(--slate-200);
  border-right: 1px solid var(--slate-200);
  text-align: center;
  font-size: 14px;
  font-weight: 650;
  font-family: var(--font-num);
  background: #fff;
}
.pub-stepper input:focus {
  box-shadow: inset 0 0 0 2px var(--brand-glow);
  outline: none;
}

.pub-exam-score-hint {
  grid-column: 1 / -1;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: #fff7ed;
  color: var(--brand-600);
  font-size: 11px;
  line-height: 1.6;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pub-exam-score-hint svg {
  width: 16px;
  height: 16px;
  color: var(--brand-600);
  flex: 0 0 auto;
}
.pub-exam-score-hint b {
  font-family: var(--font-num);
  color: var(--brand-600);
}

/* 进度明细 */
.pub-detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-sm);
}

.pub-detail-stat {
  padding: 11px;
  border-right: 1px solid var(--slate-200);
  text-align: center;
}

.pub-detail-stat:last-child { border-right: 0; }
.pub-detail-stat b {
  display: block;
  color: var(--text);
  font-family: var(--font-num);
  font-size: 19px;
}
.pub-detail-stat span {
  color: var(--text-light);
  font-size: 10px;
}

.pub-detail-tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 10px;
  overflow-x: auto;
}

.pub-detail-tab {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  background: #fff;
  color: var(--text-light);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

.pub-detail-tab.active {
  border-color: var(--brand);
  background: var(--brand-100);
  color: var(--brand-600);
}

.pub-detail-table {
  border: 1px solid var(--slate-200);
  border-radius: var(--r-sm);
  overflow: hidden;
}

.pub-detail-row {
  display: grid;
  grid-template-columns: minmax(130px, 1.2fr) minmax(130px, 1fr) 100px minmax(160px, 1.5fr);
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px 11px;
  border-bottom: 1px solid var(--slate-200);
  font-size: 12px;
}

.pub-detail-row:last-child { border-bottom: 0; }
.pub-detail-row.head {
  min-height: 36px;
  background: var(--slate-50);
  color: var(--text-light);
  font-size: 10px;
  font-weight: 700;
}

.pub-person {
  min-width: 0;
}

.pub-person-name {
  color: var(--text);
  font-weight: 650;
  overflow-wrap: anywhere;
}

.pub-person-erp,
.pub-detail-time {
  color: var(--text-light);
  font-family: var(--font-num);
  overflow-wrap: anywhere;
}

.pub-status {
  width: fit-content;
  padding: 3px 7px;
  border-radius: var(--r-xs);
  font-size: 10px;
  font-weight: 700;
}

.pub-status.pending { background: var(--slate-100); color: var(--slate-600); }
.pub-status.acked,
.pub-status.studied,
.pub-status.exam_ready { background: #e0f2fe; color: #0369a1; }
.pub-status.done { background: #dcfce7; color: #15803d; }
.pub-status.failed { background: #fee2e2; color: #b91c1c; }

.pub-submission {
  min-width: 0;
  color: var(--text-light);
  font-size: 11px;
  line-height: 1.5;
}

.pub-submission-value + .pub-submission-value {
  margin-top: 4px;
}

.pub-submission-value b {
  color: var(--text);
  font-weight: 650;
}

.pub-submission img {
  width: 46px;
  height: 46px;
  margin-top: 4px;
  border: 1px solid var(--slate-200);
  border-radius: 7px;
  object-fit: cover;
  cursor: pointer;
}

.pub-detail-empty {
  padding: 30px 16px;
  color: var(--text-light);
  font-size: 12px;
  text-align: center;
}

.pub-loading {
  min-height: 180px;
  color: var(--text-light);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 900px) {
  .pub-filters {
    grid-template-columns: minmax(0, 1fr) minmax(140px, 190px);
  }
  .pub-segments {
    grid-column: 1 / -1;
    justify-self: start;
  }
  .pub-detail-row {
    grid-template-columns: minmax(120px, 1.2fr) minmax(110px, 1fr) 90px;
  }
  .pub-detail-row > :last-child {
    grid-column: 1 / -1;
  }
  .pub-detail-row.head > :last-child {
    display: none;
  }
}

@media (max-width: 767px) {
  .pub-page {
    padding: 0 10px 12px;
  }
  .pub-toolbar {
    padding: 13px;
    border-radius: var(--r-sm);
  }
  .pub-toolbar-title {
    font-size: var(--fs-lg);
  }
  .pub-toolbar-scope {
    max-width: 190px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .pub-secondary-btn .pub-btn-text,
  .pub-primary-btn .pub-btn-text {
    display: none;
  }
  .pub-toolbar-actions .pub-secondary-btn,
  .pub-toolbar-actions .pub-primary-btn {
    width: 42px;
    min-height: 42px;
    padding: 0;
  }
  .pub-summary {
    grid-template-columns: 1fr 1fr;
  }
  .pub-summary-item:nth-child(2) {
    border-right: 0;
  }
  .pub-summary-item:nth-child(-n+2) {
    border-bottom: 1px solid var(--border);
  }
  .pub-summary-item {
    padding: 13px 14px;
  }
  .pub-summary-value {
    font-size: 21px;
  }
  .pub-filters {
    grid-template-columns: 1fr;
    padding: 10px;
  }
  .pub-segments {
    grid-column: auto;
    width: 100%;
  }
  .pub-segment {
    padding: 0 7px;
  }
  .pub-list-grid {
    grid-template-columns: 1fr;
  }
  .pub-task {
    padding: 14px 13px;
    border-radius: var(--r-sm);
  }
  .pub-mask {
    padding: 0;
    align-items: flex-end;
  }
  .pub-modal,
  .pub-modal.small,
  .pub-modal.large {
    width: 100%;
    max-height: 93vh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    transform: translateY(100%);
  }
  .pub-mask.show .pub-modal {
    transform: translateY(0);
  }
  .pub-modal-head {
    min-height: 60px;
  }
  .pub-sheet-handle {
    display: block;
  }
  .pub-insert-btn {
    opacity: 1;
  }
  .pub-fab-add {
    display: inline-flex;
  }
  .pub-modal-body {
    padding: 14px;
    padding-bottom: 90px;
  }
  .pub-modal-foot {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .pub-modal-foot .pub-primary-btn,
  .pub-modal-foot .pub-secondary-btn {
    flex: 1;
  }
  .pub-form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .pub-control.full,
  .pub-builder {
    grid-column: auto;
  }
  .pub-builder-inline,
  .pub-exam-settings {
    grid-template-columns: 1fr;
  }
  .pub-image-picker {
    grid-template-columns: 1fr;
  }
  .pub-detail-summary {
    grid-template-columns: 1fr 1fr;
  }
  .pub-detail-stat:nth-child(2) { border-right: 0; }
  .pub-detail-stat:nth-child(-n+2) { border-bottom: 1px solid var(--slate-200); }
  .pub-detail-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 10px;
    padding: 10px;
  }
  .pub-detail-row.head {
    display: none;
  }
  .pub-detail-row > :nth-child(2) {
    grid-column: 1;
  }
  .pub-detail-row > :nth-child(3) {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
  .pub-detail-row > :last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 374px) {
  .pub-page { padding-inline: 8px; }
  .pub-task-top { flex-direction: column; }
  .pub-task-tags { justify-content: flex-start; }
  .pub-task-actions .pub-secondary-btn,
  .pub-task-actions .pub-danger-btn { flex: 1; }
  .pub-type-option {
    grid-template-columns: 38px minmax(0, 1fr) 16px;
    gap: 9px;
  }
  .pub-type-icon { width: 38px; height: 38px; }
}

/* ==================== 九宫格预览 ==================== */
.pub-grid-hint {
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: var(--r-sm, 10px);
  background: var(--brand-50, #fff7ed);
  border: 1px solid var(--brand-100, #ffedd5);
  color: var(--brand-700, #c2410c);
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.5;
}

.pub-jiugong-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.pub-jiugong-cell {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 8px;
  background: var(--slate-100, #f1f5f9);
  border: 1px solid var(--slate-200, #e2e8f0);
  transition: transform var(--dur-2, 0.2s) var(--ease-out, ease);
}

.pub-jiugong-cell:hover {
  transform: scale(1.02);
  border-color: var(--brand, #f97316);
}

.pub-jiugong-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pub-jiugong-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-family: var(--font-num, inherit);
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

.pub-btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: pubGridSpin 0.7s linear infinite;
}

@keyframes pubGridSpin {
  to { transform: rotate(360deg); }
}

@media (max-width: 480px) {
  .pub-jiugong-grid { gap: 4px; }
  .pub-jiugong-badge { min-width: 16px; height: 16px; line-height: 16px; font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .pub-task,
  .pub-mask,
  .pub-modal {
    animation: none;
    transition: none;
  }
}

/* ==================== 分数配置（集成于任务发布） ==================== */
.pub-toolbar-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.score-modal { width: min(720px, 100%); }

.score-dept-select {
  width: auto;
  max-width: 170px;
}

.score-tabs {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 16px 0;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.score-tab {
  margin-bottom: -1px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: var(--r-sm, 10px) var(--r-sm, 10px) 0 0;
  background: transparent;
  color: var(--text-light);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  transition: color var(--dur-2), background var(--dur-2), border-color var(--dur-2);
}

.score-tab:hover {
  color: var(--brand-600);
  background: var(--brand-50, #fff7ed);
}

.score-tab.active {
  border-color: var(--border);
  background: var(--brand-600);
  color: #fff;
}

.score-body {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 14px 16px 18px;
}

.sc-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 13px;
  border: 1px solid var(--slate-200);
  border-left: 3px solid var(--slate-200);
  border-radius: var(--r-sm, 10px);
  background: #fff;
  transition: background var(--dur-2), border-color var(--dur-2);
}

.sc-row.changed {
  border-color: var(--brand-300, #fdba74);
  border-left-color: var(--brand);
  background: var(--brand-50, #fff7ed);
}

.sc-text {
  flex: 1;
  min-width: 0;
}

.sc-label {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.4;
}

.sc-hint {
  display: block;
  margin-top: 2px;
  color: var(--text-light);
  font-size: 11px;
  line-height: 1.5;
}

.sc-badge {
  display: inline-block;
  margin-left: 7px;
  padding: 1px 7px;
  border: 1px solid var(--brand-200, #fed7aa);
  border-radius: 999px;
  background: var(--brand-50, #fff7ed);
  color: var(--brand-700, #c2410c);
  font-style: normal;
  font-size: 10px;
  font-weight: 650;
  vertical-align: 1px;
}

.sc-input {
  box-sizing: border-box;
  flex: 0 0 96px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--slate-300);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-family: var(--font-num, inherit);
  font-size: 14px;
  font-weight: 700;
  text-align: right;
  transition: border-color var(--dur-2);
}

.sc-input:focus,
.sc-rule-input:focus {
  outline: none;
  border-color: var(--brand);
}

.sc-switch-row {
  cursor: pointer;
}

.sc-switch {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 44px;
  width: 44px;
  height: 25px;
  margin: 0;
  border: 1px solid var(--slate-300);
  border-radius: 999px;
  background: var(--slate-200);
  position: relative;
  cursor: pointer;
  transition: background var(--dur-2), border-color var(--dur-2);
}

.sc-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--dur-2) var(--ease-out, ease);
}

.sc-switch:checked {
  border-color: var(--brand-600);
  background: var(--brand-600);
}

.sc-switch:checked::after {
  transform: translateX(19px);
}

.sc-rule-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-sm, 10px);
  background: #fff;
}

.sc-del-btn {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  transition: color var(--dur-2), transform var(--dur-1);
}

.sc-del-btn:hover {
  color: var(--danger);
}

.sc-del-btn:active {
  transform: scale(0.88);
}

.sc-del-btn svg {
  display: block;
  width: 16px;
  height: 16px;
}

.sc-rule-text-wrap {
  flex: 1;
  min-width: 0;
}

.sc-rule-num-wrap {
  flex: 0 0 auto;
}

.sc-fld {
  display: block;
  margin-bottom: 4px;
  color: var(--text-light);
  font-size: 11px;
}

.sc-rule-text,
.sc-rule-num {
  box-sizing: border-box;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--slate-300);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  transition: border-color var(--dur-2);
}

.sc-rule-text:focus,
.sc-rule-num:focus {
  outline: none;
  border-color: var(--brand);
}

.sc-rule-num {
  width: auto;
  font-family: var(--font-num, inherit);
  font-weight: 700;
  text-align: right;
}

.num-sm {
  width: 76px;
}

.num-mult {
  width: 88px;
}

.sc-unit {
  margin-left: 5px;
  color: var(--text-light);
  font-size: 12px;
}

.sc-add-btn {
  padding: 8px 16px;
  border: 1px dashed var(--brand-400);
  border-radius: 8px;
  background: var(--slate-50);
  color: var(--brand-600);
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: background var(--dur-2), border-color var(--dur-2), color var(--dur-2),
              transform var(--dur-1);
}

.sc-add-btn:hover {
  border-color: var(--brand-600);
  background: var(--brand-100);
}

.sc-add-btn:active {
  transform: scale(0.97);
}

.score-note {
  margin: 4px 2px 0;
  color: var(--text-light);
  font-size: 11px;
  line-height: 1.6;
}

.score-empty {
  min-height: 160px;
  border: 1px dashed var(--slate-300);
  border-radius: var(--r-md, 14px);
  background: var(--slate-50);
  color: var(--text-light);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 767px) {
  .pub-toolbar-actions {
    gap: 8px;
  }
  .pub-modal.score-modal {
    width: 100%;
  }
  .score-dept-select {
    max-width: 132px;
  }
  .score-tabs {
    padding: 9px 12px 0;
    gap: 6px;
  }
  .score-tab {
    padding: 7px 11px;
    font-size: 12px;
  }
  .score-body {
    padding: 11px 12px 14px;
  }
  .sc-row,
  .sc-rule-row {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 11px;
  }
  .sc-row .sc-input {
    flex: 1 1 100%;
    text-align: left;
  }
  .sc-rule-text-wrap {
    flex: 1 1 calc(100% - 32px);
  }
  .sc-rule-num-wrap {
    flex: 1 1 auto;
  }
  .num-sm,
  .num-mult {
    width: auto;
    min-width: 56px;
  }
}
