/* Collapsed work-item cards under a chat message (work_item_cards.js, W2.9). */
.chat-wi-cards {
  /* The cards answer to their own width (the thread pane is narrow even in a wide window). */
  container-type: inline-size;
  display: grid;
  /* minmax(0, 1fr): a card never grows with its title; long titles end in "…" instead. */
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  max-width: 560px;
  margin-top: 6px;
}

.chat-wi-card-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: start;
  min-width: 0;
}

.chat-wi-open {
  align-self: start;
}

.chat-wi-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  border-radius: 8px;
  background: var(--panel-raised);
}

.chat-wi-card[data-kind="legendary"] {
  border-left-color: var(--purple);
}

.chat-wi-card[data-kind="finding"],
.chat-wi-card[data-kind="fixreport"] {
  border-left-color: var(--amber);
}

.chat-wi-card[data-state="missing"] {
  border-left-color: var(--line-strong);
  opacity: 0.8;
}

.chat-wi-summary {
  display: flex;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
  padding: 6px 10px;
  cursor: pointer;
  list-style: none;
}

.chat-wi-summary::-webkit-details-marker {
  display: none;
}

.chat-wi-summary::before {
  flex: none;
  align-self: center;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid var(--muted);
  content: "";
}

.chat-wi-card[open] > .chat-wi-summary::before {
  transform: rotate(90deg);
}

.chat-wi-title {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-wi-line {
  flex: none;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.chat-wi-body {
  padding: 0 10px 8px 23px;
}

.chat-wi-text {
  margin: 0 0 6px;
  color: var(--muted-bright);
  font-size: 13px;
  white-space: pre-wrap;
}

.chat-wi-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 2px 12px;
  margin: 0 0 6px;
  font-size: 12px;
}

.chat-wi-facts dt {
  color: var(--muted);
}

.chat-wi-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.chat-wi-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

@media (max-width: 720px) {
  .chat-wi-line {
    display: none;
  }
}

@container (max-width: 440px) {
  .chat-wi-line {
    display: none;
  }
}

/* Phones (<html data-chat-layout="phone">, mobile_shell.js): 44 px targets, readable text. */
html[data-chat-layout="phone"] .chat-wi-summary {
  align-items: center;
  min-height: 44px;
  padding: 6px 12px;
}

html[data-chat-layout="phone"] .chat-wi-title {
  font-size: 15px;
}

html[data-chat-layout="phone"] .chat-wi-body {
  padding: 0 12px 10px 25px;
}

html[data-chat-layout="phone"] .chat-wi-text {
  font-size: 15px;
}

html[data-chat-layout="phone"] .chat-wi-facts {
  font-size: 14px;
}

html[data-chat-layout="phone"] .chat-wi-actions .chat-button {
  min-height: 44px;
  padding: 0 14px;
}

html[data-chat-layout="phone"] .chat-wi-open {
  min-height: 44px;
}
