/* 已批准状态卡的局部样式：只由真实 data-state / data-phase 呈现状态，不推算进度。 */
.job-status {
  --job-status-ink: #172c26;
  --job-status-green: #2f6658;
  --job-status-border: #dce4df;
  --job-status-muted: #63736b;
  --job-status-soft: #edf3ef;
  --job-status-tone: var(--job-status-green);
  --job-status-tone-soft: var(--job-status-soft);
  --job-status-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  box-sizing: border-box;
  width: 100%;
  max-width: 560px;
  min-width: 0;
  margin-inline: auto;
  padding: 24px;
  border: 1px solid var(--job-status-border);
  border-radius: 16px;
  background: #fff;
  color: var(--job-status-ink);
  box-shadow: 0 10px 32px rgb(23 44 38 / 5%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  text-align: left;
  overflow-wrap: anywhere;
  color-scheme: light;
}

.job-status *,
.job-status *::before,
.job-status *::after {
  box-sizing: border-box;
}

.job-status[hidden],
.job-status [hidden] {
  display: none !important;
}

/* 待核对使用琥珀色；失败及离线使用深灰，避免继续运行的视觉暗示。 */
.job-status[data-state="warning"] {
  --job-status-tone: #89601c;
  --job-status-tone-soft: #f9f3e7;
}

.job-status[data-state="error"],
.job-status[data-state="offline"] {
  --job-status-tone: #4f5b55;
  --job-status-tone-soft: #eef0ed;
}

.job-status .job-status__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-width: 0;
}

.job-status .job-status__badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--job-status-tone-soft);
  color: var(--job-status-tone);
  font-size: 13px;
  line-height: 1.6;
  font-weight: 600;
}

.job-status .job-status__badge::before {
  content: "";
  flex: 0 0 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* 等宽数字只改变文字宽度表现；更新经过时间不需要替换光圈或卡片节点。 */
.job-status .job-status__elapsed {
  margin-left: auto;
  color: var(--job-status-muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 15px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.job-status .job-status__visual {
  position: relative;
  display: grid;
  place-items: center;
  width: 80px;
  height: 80px;
  margin: 12px auto;
  color: var(--job-status-tone);
}

.job-status .job-status__visual::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--job-status-tone-soft);
  pointer-events: none;
}

/* 四角由静态细线绘制，不依赖额外节点，也不跟随光圈旋转。 */
.job-status .job-status__visual::after {
  content: "";
  position: absolute;
  inset: 8px;
  background:
    linear-gradient(currentColor, currentColor) left top / 12px 1.5px,
    linear-gradient(currentColor, currentColor) left top / 1.5px 12px,
    linear-gradient(currentColor, currentColor) right top / 12px 1.5px,
    linear-gradient(currentColor, currentColor) right top / 1.5px 12px,
    linear-gradient(currentColor, currentColor) left bottom / 12px 1.5px,
    linear-gradient(currentColor, currentColor) left bottom / 1.5px 12px,
    linear-gradient(currentColor, currentColor) right bottom / 12px 1.5px,
    linear-gradient(currentColor, currentColor) right bottom / 1.5px 12px;
  background-repeat: no-repeat;
  opacity: 0.58;
  pointer-events: none;
}

.job-status .job-status__aperture {
  position: relative;
  display: block;
  width: 48px;
  height: 48px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform-box: view-box;
  transform-origin: 50% 50%;
}

/* 状态指示：仅处理中旋转光圈、呼吸状态点；1.2 秒线性循环不代表完成比例。 */
.job-status:is([data-state="queued"], [data-state="preparing"], [data-state="generating"]) .job-status__aperture {
  animation: job-status-aperture-turn 1.2s linear infinite;
}

.job-status:is([data-state="queued"], [data-state="preparing"], [data-state="generating"]) .job-status__badge::before {
  animation: job-status-dot-breathe 1.2s linear infinite;
}

@keyframes job-status-aperture-turn {
  to { transform: rotate(360deg); }
}

@keyframes job-status-dot-breathe {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.job-status .job-status__steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0 0 16px;
  padding: 0;
}

.job-status .job-status__step {
  position: relative;
  min-width: 0;
  color: var(--job-status-muted);
  text-align: center;
}

.job-status .job-status__step::after {
  content: "";
  position: absolute;
  top: 12px;
  left: 50%;
  width: 100%;
  height: 1px;
  background: var(--job-status-border);
}

.job-status .job-status__step:last-child::after {
  display: none;
}

.job-status .job-status__step[data-phase="done"]::after {
  background: #9ab4a7;
}

.job-status .job-status__node {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin: 0 auto 6px;
  border: 1px solid var(--job-status-border);
  border-radius: 50%;
  background: #fff;
  color: var(--job-status-muted);
  font-size: 13px;
  line-height: 1;
  font-weight: 600;
}

.job-status .job-status__step-label {
  display: block;
  font-size: 15px;
  line-height: 1.6;
}

.job-status .job-status__step[data-phase="done"] .job-status__node {
  border-color: #d4e2d9;
  background: var(--job-status-soft);
  color: var(--job-status-green);
}

.job-status .job-status__step[data-phase="current"] .job-status__node {
  border-color: var(--job-status-tone);
  background: var(--job-status-tone);
  color: #fff;
}

.job-status .job-status__step[data-phase="current"] .job-status__step-label {
  color: var(--job-status-ink);
  font-weight: 600;
}

.job-status .job-status__title {
  margin: 0;
  color: var(--job-status-ink);
  font-size: 23px;
  line-height: 1.4;
  letter-spacing: -0.3px;
  font-weight: 650;
  text-align: center;
}

.job-status .job-status__message {
  margin: 8px 0 0;
  color: var(--job-status-muted);
  font-size: 15px;
  line-height: 1.65;
  text-align: center;
}

.job-status .job-status__note {
  margin: 6px 0 0;
  color: var(--job-status-muted);
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
}

/* 不设固定卡高或截断正文；用紧凑间距把操作上移，长提示仍可自然撑开。 */
.job-status .job-status__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

/* 只覆盖卡内现有按钮；单个可见操作自动铺满，不影响页面其它 .btn。 */
.job-status .job-status__actions .btn {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--job-status-border);
  border-radius: 9px;
  background: #fff;
  color: var(--job-status-ink);
  box-shadow: none;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  font-weight: 550;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  cursor: pointer;
  transform: none;
  transition: none;
  -webkit-tap-highlight-color: transparent;
}

.job-status .job-status__actions .btn-primary {
  border-color: var(--job-status-green);
  background: var(--job-status-green);
  color: #fff;
}

.job-status .job-status__actions .btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: rgb(23 44 38 / 5%);
  opacity: 0;
  transition: opacity 180ms var(--job-status-ease-out);
  pointer-events: none;
}

.job-status .job-status__actions .btn-primary::before {
  background: rgb(255 255 255 / 12%);
}

.job-status .job-status__actions .btn:focus-visible {
  outline: 3px solid var(--job-status-green);
  outline-offset: 3px;
}

.job-status .job-status__actions .btn:is(:disabled, [aria-disabled="true"]) {
  opacity: 0.55;
  cursor: default;
}

@media (hover: hover) and (pointer: fine) {
  .job-status .job-status__actions .btn:not(:disabled):not([aria-disabled="true"]):hover::before {
    opacity: 1;
  }
}

/* 手机只收束留白和标题，保留 80px 图形区、15px 正文与至少 44px 操作目标。 */
@media (max-width: 480px) {
  .job-status {
    padding: 20px;
  }

  .job-status .job-status__steps {
    margin-bottom: 12px;
  }

  .job-status .job-status__title {
    font-size: 22px;
  }

  .job-status .job-status__actions .btn {
    padding-inline: 8px;
  }
}

/* 减动态时彻底停掉组件及伪元素动画/过渡；保留静态摄影符号和全部状态文字。 */
@media (prefers-reduced-motion: reduce) {
  .job-status,
  .job-status::before,
  .job-status::after,
  .job-status *,
  .job-status *::before,
  .job-status *::after {
    animation: none !important;
    transition: none !important;
  }

  .job-status .job-status__aperture {
    transform: none;
  }
}
