/* ui-work-reply.css - a reply that works on the user's computer (ui-work-reply.js).
   Words between steps read like the reply bubble; each step is one line in the chat's working-line type. */
.work-reply {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  margin: 0 0 12px;
}

.work-words {
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  word-break: break-word;
}
.work-words p { margin: 0 0 var(--md-para-gap); }
.work-words p:last-child { margin-bottom: 0; }
.work-words ul,
.work-words ol { margin: 0 0 var(--md-para-gap); padding-left: 22px; }
.work-words pre { white-space: pre-wrap; overflow-x: auto; }

.work-step {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.work-step-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0 2px;
  background: none;
  border: 0;
  font: inherit;
  font-size: 12px;
  line-height: 18px;
  color: var(--meta-text);
  text-align: left;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.work-step-label { flex: 0 0 auto; white-space: nowrap; color: #6b7280; }
.dark-mode .work-step-label { color: #9a9a9a; }
.work-step-target {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* the state holds a long step's newest progress line too: it gives way before the seconds do */
.work-step-state { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-step-secs { flex: 0 0 auto; white-space: nowrap; }
.work-step.waiting .work-step-state { color: var(--color-text); }
.work-step.error .work-step-state { color: #b42318; }
.dark-mode .work-step.error .work-step-state { color: #f97066; }
.work-step-chevron {
  display: inline-flex;
  align-self: center;
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
}
.work-step-chevron svg { width: var(--icon-size); height: var(--icon-size); display: block; }
html:not([data-input="touch"]) .work-step-head:hover .work-step-chevron,
.work-step.expanded .work-step-chevron { opacity: 1; }
.work-step.expanded .work-step-chevron { transform: rotate(180deg); }
@media (hover: none) and (pointer: coarse) {
  .work-step-chevron { opacity: 1; }
}
/* a step's small picture: the frame is rounded and outlined, the picture itself never is */
.work-step-thumb {
  align-self: flex-start;
  max-width: 100%;
  margin: 6px 2px 2px;
  border: 1px solid var(--color-border);
  border-radius: var(--img-radius);
  overflow: hidden;
  line-height: 0;
}
.work-step-thumb img { display: block; width: auto; max-width: 100%; height: 120px; object-fit: contain; }
.work-step-body { display: none; margin: 6px 2px 0; }
.work-step.expanded .work-step-body { display: flex; flex-direction: column; gap: 6px; }
.work-step-section-label { font-size: 11px; color: var(--meta-text); margin: 0 0 2px; }
.work-step-body .agent-tool-pre { max-height: 240px; overflow: auto; margin: 0; }

/* the checklist: first in the reply, one line when folded (it wears the step head's type), every part when opened */
.work-checklist { display: flex; flex-direction: column; min-width: 0; }
.work-checklist-count { flex: 0 0 auto; color: var(--color-text); font-variant-numeric: tabular-nums; }
.work-checklist-now { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-checklist-items { display: none; margin: 6px 2px 0; padding-left: 22px; font-size: 14px; line-height: 22px; color: var(--color-text); }
.work-checklist.expanded .work-checklist-items { display: block; }
.work-checklist.expanded .work-step-chevron { opacity: 1; transform: rotate(180deg); }
.work-checklist-item.doing { font-weight: 500; }
.work-checklist-item.done { color: var(--meta-text); text-decoration: line-through; }

/* the user's answer to a step (asked on the card at the bottom) stays as one line under the step's head */
.work-step-answer { padding: 0 2px; font-size: 12px; line-height: 18px; color: var(--meta-text); }

/* words the user sent while the reply worked: their own bubble, inside the reply where they were sent. The look is
   the chat's user bubble (ai-chat-base.css .chat-messages .msg.user .bubble); its classes are not reused because
   scripts walk .msg rows as messages, and this is part of the reply */
.work-said { display: flex; justify-content: flex-end; min-width: 0; margin: 6px 0; }
.work-said-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: calc(18px * var(--corner-k));
  background: #f9fafb;
  color: var(--color-text);
  font-size: 14px;
  line-height: 20px;
  white-space: pre-wrap;
  word-break: break-word;
}
.dark-mode .work-said-bubble { background: #303030; }

.work-thinking {
  display: flex;
  align-items: baseline;
  padding: 0 2px;
  font-size: 12px;
  line-height: 18px;
  color: var(--meta-text);
  font-variant-numeric: tabular-nums;
}
