/* BioStudio AI — read-only work-item history modal */

.wi-history-dialog {
  width: min(760px, 96vw);
  max-height: min(86vh, 720px);
}

.wi-history-readonly {
  margin-left: auto;
  margin-right: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft, #5d6470);
  border: 1px solid var(--win-border, rgba(0, 0, 0, 0.12));
  border-radius: 999px;
  padding: 2px 8px;
}

/* Themes render .platform-dialog frosted (~64% alpha), which is fine for a
   one-line alert but leaves the wallpaper showing through a dense timeline.
   The body opts back into an opaque surface; the header keeps the frost. */
.wi-history-body {
  background: var(--win-body-bg, var(--surface, #fff));
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px 14px 14px;
  gap: 10px;
}

/* --- summary --- */

.wi-history-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wi-history-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.wi-history-fact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2, rgba(0, 0, 0, 0.035));
  border: 1px solid var(--win-border, rgba(0, 0, 0, 0.06));
}

.wi-history-fact-k {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft, #5d6470);
}

.wi-history-fact-v {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink, #1b1b1f);
  overflow-wrap: anywhere;
}

.wi-history-people {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.wi-history-people-k {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft, #5d6470);
}

.wi-history-pill {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  white-space: nowrap;
}

.wi-history-pill.is-access {
  background: rgba(220, 38, 38, 0.1);
  color: #b91c1c;
}

.wi-history-warn {
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(234, 88, 12, 0.12);
  color: #9a3412;
}

/* --- controls --- */

.wi-history-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.wi-history-search {
  flex: 1 1 200px;
  min-width: 0;
  font: inherit;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--win-border, rgba(0, 0, 0, 0.14));
  background: var(--surface, #fff);
  color: var(--ink, #1b1b1f);
}

.wi-history-select {
  font: inherit;
  font-size: 12.5px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--win-border, rgba(0, 0, 0, 0.14));
  background: var(--surface, #fff);
  color: var(--ink, #1b1b1f);
}

.wi-history-scope {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--ink-soft, #5d6470);
  white-space: nowrap;
}

.wi-history-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wi-history-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid var(--win-border, rgba(0, 0, 0, 0.12));
  background: transparent;
  color: var(--ink-soft, #5d6470);
  opacity: 0.55;
}

.wi-history-chip.is-on {
  opacity: 1;
  color: var(--chip-color);
  border-color: color-mix(in srgb, var(--chip-color) 45%, transparent);
  background: color-mix(in srgb, var(--chip-color) 12%, transparent);
}

.wi-history-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chip-color);
}

/* --- timeline --- */

.wi-history-timeline {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border-top: 1px solid var(--win-border, rgba(0, 0, 0, 0.08));
  padding-top: 8px;
}

.wi-history-group + .wi-history-group {
  margin-top: 12px;
}

.wi-history-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft, #5d6470);
  position: sticky;
  top: 0;
  background: var(--win-body-bg, var(--surface, #fff));
  padding: 4px 0;
  z-index: 1;
}

.wi-history-count {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-2, rgba(0, 0, 0, 0.06));
}

.wi-history-row {
  display: flex;
  gap: 10px;
  padding: 6px 8px 6px 6px;
  border-radius: 8px;
  border-left: 3px solid var(--row-color, #94a3b8);
  background: color-mix(in srgb, var(--row-color, #94a3b8) 6%, transparent);
}

.wi-history-row + .wi-history-row {
  margin-top: 4px;
}

.wi-history-dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--row-color, #94a3b8);
}

.wi-history-main {
  min-width: 0;
  flex: 1 1 auto;
}

.wi-history-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}

.wi-history-event {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--row-color, var(--ink, #1b1b1f));
}

.wi-history-file {
  font-size: 12.5px;
  color: var(--ink, #1b1b1f);
  overflow-wrap: anywhere;
}

.wi-history-detail {
  font-size: 12px;
  color: var(--ink-soft, #5d6470);
  overflow-wrap: anywhere;
}

.wi-history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
  font-size: 11px;
  color: var(--ink-soft, #5d6470);
}

.wi-history-seq {
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}

.wi-history-empty {
  margin: 16px 0;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft, #5d6470);
}

/* Dark mode is a `dark` class on body / #desktop; the rest of the modal rides
   on the shared surface variables, so only the tinted fills need softening. */
body.dark .wi-history-fact,
.dark .wi-history-fact {
  background: rgba(255, 255, 255, 0.05);
}

body.dark .wi-history-count,
.dark .wi-history-count {
  background: rgba(255, 255, 255, 0.08);
}

body.dark .wi-history-pill,
.dark .wi-history-pill {
  background: rgba(96, 165, 250, 0.18);
  color: #bfdbfe;
}

body.dark .wi-history-pill.is-access,
.dark .wi-history-pill.is-access {
  background: rgba(248, 113, 113, 0.18);
  color: #fecaca;
}
