/* ==========================================================================
   Delivery log
   Every message sent or tried, newest first. A list rather than a table, the
   way the audit log is: each entry is a sentence (what went, to whom, through
   what, and when), and the ones that did not go carry a paragraph under them
   saying why. Every class here starts dlog, so nothing on any other page can
   match it.
   ========================================================================== */

.dlog { margin: 0; padding: 0; list-style: none; }

.dlog__entry {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.dlog__entry:last-child { border-bottom: 0; }

.dlog__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px 14px;
}

/* The pill keeps its own height and lines up with the first line of words. */
.dlog__badge { flex: none; margin-top: 1px; cursor: help; }
.dlog__badge--sent     { background: var(--ok-bg);   color: var(--ok-fg); }
.dlog__badge--failed   { background: var(--bad-bg);  color: var(--bad-fg); }
.dlog__badge--retrying { background: var(--warn-bg); color: var(--warn-fg); }
.dlog__badge--waiting  { background: var(--mute-bg); color: var(--mute-fg); }

.dlog__what {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1 1 260px;
  min-width: 0;
}

.dlog__title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  font-size: var(--fs-md);
  color: var(--txt);
}
.dlog__subject { font-weight: var(--fw-semibold); overflow-wrap: anywhere; }

/* What it was for, said quietly: a test is not news, a report will be. */
.dlog__purpose {
  font-size: var(--fs-xs);
  color: var(--txt-3);
}

.dlog__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 6px;
  font-size: var(--fs-sm);
  color: var(--txt-3);
}
.dlog__who { color: var(--txt-2); font-weight: var(--fw-medium); overflow-wrap: anywhere; }
.dlog__address { overflow-wrap: anywhere; }
.dlog__dot { color: var(--line-strong); }

.dlog__channel {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--txt-2);
}
.dlog__channel svg { width: 14px; height: 14px; flex: none; align-self: center; }

/* --- the files a scheduled report carried -------------------------------- */

.dlog__files {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-sm);
  color: var(--txt-2);
}
.dlog__file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}
.dlog__file svg { width: 14px; height: 14px; flex: none; color: var(--txt-3); }
.dlog__file-name { overflow-wrap: anywhere; min-width: 0; }
.dlog__file-size { flex: none; color: var(--txt-3); font-size: var(--fs-xs); }

/* Narrowed to one run or one message from a schedule's history. */
.dlog-pinned {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-2);
  font-size: var(--fs-sm);
  color: var(--txt-2);
}

/* --- why it did not go --------------------------------------------------- */

.dlog__problem {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-left-width: 3px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: var(--fs-sm);
}
.dlog__problem--failed   { border-left-color: var(--bad); }
.dlog__problem--retrying { border-left-color: var(--warn); }
.dlog__problem--waiting  { border-left-color: var(--mute); }

.dlog__problem > p { margin: 0; }
.dlog__problem > p + p { margin-top: 6px; }

.dlog__error { color: var(--txt); }

/* The server's own words, for whoever has to take them to a support desk. */
.dlog__reply { color: var(--txt-3); overflow-wrap: anywhere; }
.dlog__reply code {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--txt-2);
}
.dlog__reply-word { margin-right: 2px; }

.dlog__tries {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
  color: var(--txt-3);
  font-size: var(--fs-xs);
}

.dlog__fix { margin-top: 10px; }

/* The period's figures wrap like the audit log's people strip. */
.dlog-summary { row-gap: var(--sp-4); }

/* --- on a phone ---------------------------------------------------------- */

@container content (max-width: 560px) {
  .dlog__entry { padding: 12px 14px; }

  /* The fix takes the full width under the reason, so it reads as this
     message's and is easy to reach with a thumb. */
  .dlog__fix { display: flex; width: 100%; justify-content: center; }
}
