/* attempt_history_html, root .ah-wrap. The root rule stays bare, every other
   selector is scoped :where(.ah-wrap), which adds zero specificity. */

.ah-wrap {
  font-family: var(--ch-font-primary);
  color: var(--ch-text-primary);
}
:where(.ah-wrap) .ah-chip-strip {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: var(--ch-space-md);
}
:where(.ah-wrap) .ah-chip-strip:empty {
  display: none;
}
:where(.ah-wrap) .ah-chip {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--ch-font-primary);
  background: transparent;
  color: var(--ch-text-secondary);
  border: 1.5px solid var(--ch-border);
  border-radius: var(--ch-radius-full);
  cursor: pointer;
  min-height: 28px;
  transition: background var(--ch-transition-fast),
              color var(--ch-transition-fast),
              border-color var(--ch-transition-fast);
}
:where(.ah-wrap) .ah-chip:hover {
  background: var(--ch-bg-secondary);
  color: var(--ch-text-primary);
}
:where(.ah-wrap) .ah-chip.ah-chip-active {
  background: var(--ch-accent-primary);
  color: var(--ch-text-inverse);
  border-color: var(--ch-accent-primary);
}
:where(.ah-wrap) .ah-chip:focus-visible {
  outline: 2px solid var(--ch-border-focus);
  outline-offset: 2px;
}
:where(.ah-wrap) .ah-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
:where(.ah-wrap) .ah-rows:empty {
  display: none;
}
:where(.ah-wrap) .ah-empty {
  display: none;
  padding: 14px 16px;
  color: var(--ch-text-muted);
  font-size: 13px;
  line-height: 1.5;
}
:where(.ah-wrap) .ah-empty.ah-visible {
  display: block;
}

/* Row chrome — one rule, six variants via data-kind */
:where(.ah-wrap) .ah-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: var(--ch-bg-card);
  border: 1px solid var(--ch-border);
  border-left: 3px solid var(--ch-border);
  border-radius: var(--ch-radius-md);
}
:where(.ah-wrap) .ah-row[data-kind="passed"] {
  border-left-color: var(--ch-success);
}
:where(.ah-wrap) .ah-row[data-kind="failed"] {
  border-left-color: var(--ch-danger);
}
:where(.ah-wrap) .ah-row[data-kind="cancelled"],
:where(.ah-wrap) .ah-row[data-kind="cert_expired"],
:where(.ah-wrap) .ah-row[data-kind="retired"] {
  opacity: 0.78;
  border-left-color: var(--ch-text-muted);
}
:where(.ah-wrap) .ah-row[data-kind="cert_expired"] {
  border-left-color: var(--ch-warning);
}
:where(.ah-wrap) .ah-row[data-kind="in_progress"] {
  border-left-color: var(--ch-accent-primary);
}
:where(.ah-wrap) .ah-row[data-card-hidden="true"] {
  display: none;
}

:where(.ah-wrap) .ah-row-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ch-bg-secondary);
  color: var(--ch-text-secondary);
  border-radius: var(--ch-radius-sm);
  font-size: 18px;
}
:where(.ah-wrap) .ah-row[data-kind="passed"] .ah-row-icon {
  background: var(--ch-success-bg);
  color: var(--ch-success);
}
:where(.ah-wrap) .ah-row[data-kind="failed"] .ah-row-icon {
  background: var(--ch-danger-bg);
  color: var(--ch-danger);
}
:where(.ah-wrap) .ah-row[data-kind="in_progress"] .ah-row-icon {
  background: var(--ch-accent-secondary);
  color: var(--ch-accent-primary-text, #b45309);
}
:where(.ah-wrap) .ah-row[data-kind="cert_expired"] .ah-row-icon {
  background: var(--ch-warning-bg);
  color: var(--ch-warning);
}

:where(.ah-wrap) .ah-row-body {
  min-width: 0;
}
:where(.ah-wrap) .ah-row-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 2px 0;
  color: var(--ch-text-primary);
  /* truncate; full title in the title attribute */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
:where(.ah-wrap) .ah-row-meta {
  font-size: 12px;
  color: var(--ch-text-secondary);
  line-height: 1.5;
}
:where(.ah-wrap) .ah-row-annotation {
  font-size: 12px;
  color: var(--ch-text-muted);
  font-style: italic;
  margin-top: 2px;
  line-height: 1.4;
}
:where(.ah-wrap) .ah-row-action {
  display: flex;
  gap: 6px;
}
:where(.ah-wrap) .ah-row-action:empty {
  display: none;
}
:where(.ah-wrap) .ah-row-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--ch-font-primary);
  background: transparent;
  color: var(--ch-accent-primary-text, #b45309);
  border: 1.5px solid var(--ch-accent-primary);
  border-radius: var(--ch-radius-sm);
  cursor: pointer;
  min-height: 30px;
  white-space: nowrap;
}
:where(.ah-wrap) .ah-row-btn:hover {
  background: var(--ch-accent-secondary);
}
:where(.ah-wrap) .ah-row-btn:focus-visible {
  outline: 2px solid var(--ch-border-focus);
  outline-offset: 2px;
}
:where(.ah-wrap) .ah-row-btn-primary {
  background: var(--ch-accent-primary);
  color: var(--ch-text-inverse);
}
:where(.ah-wrap) .ah-row-btn-primary:hover {
  background: var(--ch-accent-primary-hover);
  color: var(--ch-text-inverse);
}
