/* Delivery timeline: the styles for delivery-timeline.js.
 *
 * EVERY selector in this file begins with .delivery-timeline-, and this file declares no
 * element selector, no id selector, no :root variable and no @font-face of its own. It
 * therefore cannot collide with styles.css, which styles bare `table`, `th`, `td`, `button`
 * and short class names like .pill, .card, .panel and .table-wrap, and it cannot collide
 * with payment-review-queue.css, whose selectors all begin with .payment-review-. Dropping
 * this file into index.html alongside those two changes nothing already on the page, and
 * removing it again leaves an unstyled but still readable list.
 *
 * It DOES read styles.css's custom properties (--ink, --muted, --line, --panel, --blue,
 * --green, --amber, --amber-bg, --red, --radius, --shadow) so the panel looks like the rest
 * of the dashboard. Each one has a fallback in the var() call, so the module also renders
 * correctly on a page that does not load styles.css at all, which is exactly what the
 * standalone preview does.
 *
 * NARROW SCREENS. The layout is a single column below 640px and a two-column row above it.
 * At 375px there is no horizontal scroll: nothing has a fixed width, every long string is
 * allowed to wrap, and the one control is full width. tests/delivery_timeline_render_check.mjs
 * measures scrollWidth against clientWidth at 375px rather than trusting this comment.
 */

.delivery-timeline-panel {
  background: var(--panel, #ffffff);
  color: var(--ink, #1f2933);
  border-radius: var(--radius, 10px);
  box-shadow: var(--shadow, 0 1px 3px rgba(0, 0, 0, .08));
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow-wrap: break-word;
  word-break: break-word;
}

.delivery-timeline-title {
  font-size: 1.1rem;
  margin: 0 0 .4rem;
}

/* The banner is the first thing read and must not look like decoration. */
.delivery-timeline-banner {
  margin: 0 0 .6rem;
  padding: .5rem .7rem;
  border-left: 3px solid var(--blue, #2d6cdf);
  background: rgba(45, 108, 223, .07);
  font-size: .92rem;
  font-weight: 600;
}

.delivery-timeline-sub {
  margin: 0 0 .8rem;
  color: var(--muted, #62707d);
  font-size: .9rem;
}

.delivery-timeline-cancelled {
  margin: 0 0 .8rem;
  padding: .5rem .7rem;
  border-left: 3px solid var(--red, #c0392b);
  background: rgba(192, 57, 43, .07);
  font-size: .92rem;
}

/* ---------------------------------------------------------------- blockers */
.delivery-timeline-blockers {
  border: 1px solid var(--amber, #d99400);
  background: var(--amber-bg, #fff8e6);
  border-radius: var(--radius, 10px);
  padding: .7rem .9rem;
  margin: 0 0 1.1rem;
}

.delivery-timeline-blockers-clear {
  border-color: var(--green, #2e8b57);
  background: rgba(46, 139, 87, .08);
}

.delivery-timeline-blockers h3 {
  margin: 0 0 .45rem;
  font-size: .98rem;
}

.delivery-timeline-blocker-list {
  margin: 0;
  padding-left: 1.1rem;
}

.delivery-timeline-blocker {
  margin-bottom: .35rem;
  font-size: .92rem;
}

.delivery-timeline-blocker-who {
  display: inline-block;
  color: var(--muted, #62707d);
  font-size: .85rem;
}

/* ---------------------------------------------------------------- groups */
.delivery-timeline-group {
  margin: 0 0 1.2rem;
}

.delivery-timeline-group-title {
  margin: 0 0 .5rem;
  padding-bottom: .25rem;
  border-bottom: 1px solid var(--line, #dfe4ea);
  font-size: 1rem;
}

.delivery-timeline-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.delivery-timeline-row {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .6rem 0 .7rem;
  border-bottom: 1px solid var(--line, #dfe4ea);
}

.delivery-timeline-row:last-child {
  border-bottom: 0;
}

.delivery-timeline-when-text {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: .92rem;
}

.delivery-timeline-row-held .delivery-timeline-when-text,
.delivery-timeline-row-skipped .delivery-timeline-when-text {
  color: var(--muted, #62707d);
  font-weight: 500;
}

.delivery-timeline-step {
  margin: .1rem 0 .15rem;
  font-weight: 600;
}

.delivery-timeline-meta {
  margin: 0 0 .15rem;
  color: var(--muted, #62707d);
  font-size: .88rem;
}

.delivery-timeline-meta span + span::before {
  content: " \00b7  ";
}

.delivery-timeline-status {
  margin: 0;
  font-size: .9rem;
}

.delivery-timeline-status-held {
  color: var(--amber, #a76a00);
  font-weight: 600;
}

.delivery-timeline-cause-count {
  margin: .1rem 0 0;
  font-size: .87rem;
  font-weight: 600;
  color: var(--amber, #a76a00);
}

.delivery-timeline-detail dd ul {
  margin: .2rem 0 0;
  padding-left: 1.1rem;
}

.delivery-timeline-staff-changed {
  margin: .1rem 0 0;
  font-size: .87rem;
  color: var(--amber, #a76a00);
}

.delivery-timeline-content-missing {
  margin: .05rem 0 0;
  font-size: .87rem;
  color: var(--muted, #62707d);
}

.delivery-timeline-content-ok {
  margin: .05rem 0 0;
  font-size: .87rem;
  color: var(--green, #2e8b57);
}

/* Native <details>: keyboard operable and screen readable with no script at all. */
.delivery-timeline-detail {
  margin-top: .35rem;
  font-size: .86rem;
}

.delivery-timeline-detail summary {
  cursor: pointer;
  color: var(--blue, #2d6cdf);
}

.delivery-timeline-detail summary:focus-visible {
  outline: 2px solid var(--blue, #2d6cdf);
  outline-offset: 2px;
}

.delivery-timeline-detail dl {
  margin: .4rem 0 0;
  padding-left: .2rem;
}

.delivery-timeline-detail dt {
  font-weight: 600;
  margin-top: .3rem;
}

.delivery-timeline-detail dd {
  margin: 0 0 0 .1rem;
  color: var(--muted, #62707d);
}

/* ---------------------------------------------------------------- the disabled control */
.delivery-timeline-footer {
  border-top: 1px solid var(--line, #dfe4ea);
  padding-top: .8rem;
}

.delivery-timeline-disabled-action {
  width: 100%;
  padding: .55rem .9rem;
  border: 1px solid var(--line, #dfe4ea);
  border-radius: var(--radius, 10px);
  background: #f1f3f5;
  color: var(--muted, #62707d);
  font: inherit;
  cursor: not-allowed;
}

.delivery-timeline-why-disabled {
  margin: .45rem 0 0;
  font-size: .87rem;
  color: var(--muted, #62707d);
}

.delivery-timeline-empty {
  margin: .6rem 0 0;
  color: var(--muted, #62707d);
}

/* Above phone width the time sits beside the step instead of above it. */
@media (min-width: 640px) {
  .delivery-timeline-row {
    flex-direction: row;
    gap: 1rem;
  }

  .delivery-timeline-when {
    flex: 0 0 13.5rem;
  }

  .delivery-timeline-what {
    flex: 1 1 auto;
    min-width: 0;
  }

  .delivery-timeline-disabled-action {
    width: auto;
  }
}
