.sg-doc-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Keep legacy batch progress inside its own project panel. */
.ht-workspace-panel .ht-batch-progress {
  position: static !important;
  inset: auto !important;
  z-index: auto !important;
  width: auto !important;
  margin: 0 0 12px;
}
.sg-doc-button {
  appearance: none;
  border: 1px solid #9eb3c5;
  border-radius: 6px;
  background: #fff;
  color: #315f82;
  min-height: 34px;
  padding: 0 12px;
  font: 600 13px/1.2 "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  cursor: pointer;
}
.sg-doc-button:hover {
  border-color: #315f82;
  background: #f3f7fa;
}
.sg-doc-button:focus-visible,
.sg-doc-modal button:focus-visible,
.sg-doc-modal input:focus-visible,
.sg-doc-modal select:focus-visible {
  outline: 2px solid #315f82;
  outline-offset: 2px;
}
.sg-doc-button[data-primary="true"] {
  background: #315f82;
  border-color: #315f82;
  color: #fff;
}
.sg-doc-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 37, 49, 0.42);
}
.sg-doc-modal {
  width: min(900px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid #cbd6dd;
  border-radius: 10px;
  background: #fff;
  color: #243746;
  box-shadow: none;
  font: 14px/1.55 "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}
.sg-doc-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid #e1e8ec;
}
.sg-doc-modal__head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}
.sg-doc-modal__head p {
  margin: 5px 0 0;
  color: #61737f;
  font-size: 12.5px;
}
.sg-doc-modal__close {
  border: 0;
  background: transparent;
  color: #61737f;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.sg-doc-modal__body {
  display: grid;
  gap: 15px;
  padding: 18px 22px;
}
.sg-doc-field {
  display: grid;
  gap: 6px;
}
.sg-doc-field label {
  color: #405563;
  font-size: 12.5px;
  font-weight: 600;
}
.sg-doc-field :is(input, select) {
  width: 100%;
  min-height: 38px;
  box-sizing: border-box;
  border: 1px solid #cbd6dd;
  border-radius: 5px;
  background: #fff;
  color: #243746;
  padding: 7px 9px;
  font: inherit;
}
.sg-doc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.sg-doc-note {
  padding: 11px 13px;
  border: 1px solid #d7e2e8;
  border-radius: 6px;
  background: #f6f9fb;
  color: #506572;
  font-size: 12.5px;
}
.sg-doc-figure-plan {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #d7e2e8;
  border-radius: 7px;
  background: #f8fafb;
}
.sg-doc-figure-plan__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.sg-doc-figure-plan__head h3 {
  margin: 0;
  color: #243746;
  font-size: 15px;
}
.sg-doc-figure-plan__head p {
  margin: 4px 0 0;
  color: #61737f;
  font-size: 12px;
}
.sg-doc-plan-count {
  flex: none;
  padding: 3px 8px;
  border: 1px solid #cbd6dd;
  border-radius: 999px;
  background: #fff;
  color: #506572;
  font-size: 11px;
}
.sg-doc-figure-plan__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.sg-doc-plan-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid #dce5ea;
  border-radius: 6px;
  background: #fff;
}
.sg-doc-plan-card__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.sg-doc-plan-card__head span {
  color: #315f82;
  font-size: 11px;
  font-weight: 700;
}
.sg-doc-plan-card__head strong {
  color: #243746;
  font-size: 13px;
}
.sg-doc-plan-card > p {
  margin: 7px 0 4px;
  color: #405563;
  font-size: 12px;
  line-height: 1.45;
}
.sg-doc-plan-card > small {
  display: block;
  color: #6d7e89;
  font-size: 11px;
  line-height: 1.45;
}
.sg-doc-plan-refs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.sg-doc-plan-refs figure {
  min-width: 0;
  margin: 0;
  padding: 5px;
  border: 1px solid #e2e8ec;
  border-radius: 4px;
  background: #fff;
}
.sg-doc-plan-refs img {
  display: block;
  width: 100%;
  height: 82px;
  object-fit: contain;
  background: #fff;
}
.sg-doc-plan-refs figcaption {
  margin-top: 4px;
  color: #61737f;
  font-size: 10.5px;
  line-height: 1.35;
  text-align: center;
}
.sg-doc-plan-loading {
  grid-column: 1 / -1;
  padding: 20px;
  color: #61737f;
  text-align: center;
  font-size: 12.5px;
}
.sg-doc-plan-confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #405563;
  font-size: 12.5px;
  cursor: pointer;
}
.sg-doc-plan-confirm input {
  inline-size: 16px;
  block-size: 16px;
  accent-color: #315f82;
}
.sg-doc-status {
  min-height: 20px;
  color: #506572;
  font-size: 12.5px;
}
.sg-doc-status[data-error="true"] {
  color: #9a3e36;
}
.sg-doc-download-fallback {
  display: inline-block;
  margin-top: 7px;
  color: #175cd3;
  font-weight: 600;
  text-decoration: underline;
}
.sg-doc-modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 22px 20px;
  border-top: 1px solid #e1e8ec;
}
.sg-doc-modal button:disabled {
  cursor: wait;
  opacity: .58;
}
@media (max-width: 620px) {
  .sg-doc-grid { grid-template-columns: 1fr; }
  .sg-doc-figure-plan__grid { grid-template-columns: 1fr; }
  .sg-doc-modal__foot { flex-direction: column-reverse; }
  .sg-doc-modal__foot .sg-doc-button { width: 100%; }
}

.sg-job-overlay {
  position: sticky;
  top: 12px;
  z-index: 30;
  display: flex;
  width: min(100%, 760px);
  min-height: 136px;
  margin: 0 auto 14px;
  padding: 12px 20px 12px 14px;
  align-items: center;
  gap: 18px;
  border: 1px solid #d8cfc4;
  border-radius: 10px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 8px 24px rgba(55, 45, 36, .12);
}
.sg-job-overlay__fish {
  width: 120px;
  height: 120px;
  flex: 0 0 120px;
  object-fit: contain;
}
.sg-job-overlay__body {
  min-width: 0;
  flex: 1;
}
.sg-job-overlay__title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}
.sg-job-overlay__title strong {
  color: #7b3f2c;
  font-size: 15px;
}
.sg-job-overlay__title span {
  color: #6b625a;
  font-size: 12px;
  white-space: nowrap;
}
.sg-job-overlay__track {
  height: 8px;
  margin-top: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #eee9e3;
}
.sg-job-overlay__track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a75d3f, #c88761);
  transition: width .35s ease;
}
.sg-job-overlay + .sg-proposal-jobs {
  margin-top: 0;
}
@media (max-width: 720px) {
  .sg-job-overlay {
    width: calc(100% - 16px);
    margin-inline: 8px;
  }
  .sg-job-overlay__fish {
    width: 92px;
    height: 92px;
    flex-basis: 92px;
  }
  .sg-job-overlay__title {
    display: block;
  }
  .sg-job-overlay__title span {
    display: block;
    margin-top: 4px;
    white-space: normal;
  }
}

.sg-proposal-jobs {
  margin: 0 0 12px;
  border: 1px solid #ddd8d0;
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}
.sg-job-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 58px;
  padding: 10px 14px;
  border-bottom: 1px solid #e8e4de;
  background: #f8f6f2;
}
.sg-job-summary > div {
  min-width: 0;
}
.sg-job-summary strong {
  display: block;
  color: #25231f;
  font-size: 14px;
}
.sg-job-summary span {
  display: block;
  margin-top: 2px;
  color: #777169;
  font-size: 12px;
}
.sg-job-summary b {
  flex: none;
  color: #534f49;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.sg-job-summary i {
  display: inline-block;
  width: 1px;
  height: 11px;
  margin: 0 8px;
  background: #c9c3ba;
  vertical-align: -1px;
}
.sg-job-list {
  max-height: 300px;
  overflow: auto;
  scrollbar-gutter: stable;
}
.sg-job-row {
  padding: 10px 14px 9px;
  border-bottom: 1px solid #efede9;
}
.sg-job-row:last-child {
  border-bottom: 0;
}
.sg-job-row__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.sg-job-row__head > div:first-child {
  min-width: 0;
}
.sg-job-row__head strong {
  display: block;
  overflow: hidden;
  color: #302d29;
  font-size: 12.5px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sg-job-row__head span {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: #777169;
  font-size: 11.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sg-job-row__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.sg-job-row__actions em {
  min-width: 58px;
  padding: 3px 7px;
  border: 1px solid #d7d3cc;
  border-radius: 4px;
  color: #666159;
  background: #f7f5f1;
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
  text-align: center;
}
.sg-job-row__actions button {
  min-width: 46px;
  height: 25px;
  padding: 0 8px;
  border: 1px solid #cfc9c0;
  border-radius: 4px;
  color: #514b43;
  background: #fff;
  font-size: 11px;
  cursor: pointer;
}
.sg-job-row__actions button:hover {
  border-color: #a8573a;
  color: #a8573a;
}
.sg-job-row[data-tone="running"] .sg-job-row__actions em,
.sg-job-row[data-tone="checking"] .sg-job-row__actions em {
  border-color: #ddad82;
  color: #91472f;
  background: #fff5ec;
}
.sg-job-row[data-tone="queued"] .sg-job-row__actions em {
  border-color: #b6c8d4;
  color: #49697b;
  background: #f1f7fa;
}
.sg-job-row[data-tone="completed"] .sg-job-row__actions em {
  border-color: #9fc8ac;
  color: #2e7042;
  background: #eff8f1;
}
.sg-job-row[data-tone="failed"] .sg-job-row__actions em {
  border-color: #d8a49f;
  color: #9a3e36;
  background: #fff2f1;
}
.sg-job-progress {
  height: 3px;
  margin-top: 8px;
  overflow: hidden;
  background: #ece9e4;
}
.sg-job-progress span {
  display: block;
  height: 100%;
  background: #a8573a;
  transition: width .25s ease;
}
.sg-job-row[data-tone="completed"] .sg-job-progress span {
  background: #3f8554;
}
.sg-job-row[data-tone="failed"] .sg-job-progress span {
  background: #b64f46;
}
.sg-job-empty {
  padding: 24px;
  color: #777169;
  font-size: 12px;
  text-align: center;
}
@media (max-width: 900px) {
  .sg-job-summary,
  .sg-job-row__head {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }
  .sg-job-summary b {
    white-space: normal;
  }
  .sg-job-row__actions {
    width: 100%;
    justify-content: space-between;
  }
}
