/* Cut-off breach rows: the request's windows plotted either side of the cut-off,
   with the overdue span from the cut-off to now shaded across them. */

.view-swatch--overdue {
  background: repeating-linear-gradient(
    45deg,
    transparent 0 3px,
    color-mix(in srgb, var(--bad) 45%, transparent) 3px 6px
  );
  border: 1px dashed color-mix(in srgb, var(--bad) 55%, transparent);
}

.view-swatch--collection {
  background: var(--accent);
}

.view-swatch--delivery {
  background: color-mix(in srgb, var(--accent) 45%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
}

.cutoff-tally {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin-bottom: 1.1rem;
}

.cutoff-tally__label {
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.cutoff-tally__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cutoff-tally__item {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--text) 5%, transparent);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
}

.cutoff-tally__count {
  font-weight: 650;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.cutoff-tally__note {
  flex-basis: 100%;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.cutoff-row {
  margin-bottom: 0.9rem;
}

.cutoff-row__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.4rem;
}

.cutoff-row__id {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.cutoff-row__code {
  font-weight: 600;
}

.cutoff-row__ro-status {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.cutoff-badge {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--bad);
  background: var(--bad-soft);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}

.cutoff-plot {
  --cutoff-name-w: 5.2rem;
  --cutoff-value-w: 13rem;
  --cutoff-col-gap: 0.75rem;
  --cutoff-rail-h: 22px;
  --cutoff-axis-h: 1.4rem;
  /* Room above the rails for the cut-off / now marker labels. */
  --cutoff-head-h: 1.3rem;
  position: relative;
  padding-top: var(--cutoff-head-h);
}

.cutoff-plot__overlay {
  position: absolute;
  top: 0;
  bottom: var(--cutoff-axis-h);
  left: calc(var(--cutoff-name-w) + var(--cutoff-col-gap));
  right: calc(var(--cutoff-value-w) + var(--cutoff-col-gap));
  pointer-events: none;
}

/* The span the row is about: everything between the cut-off and now. */
.cutoff-overdue {
  position: absolute;
  top: var(--cutoff-head-h);
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(
    45deg,
    transparent 0 4px,
    color-mix(in srgb, var(--bad) 16%, transparent) 4px 8px
  );
}

.cutoff-overdue__label {
  font-size: 0.7rem;
  font-weight: 650;
  color: var(--bad);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  white-space: nowrap;
}

.cutoff-marker {
  position: absolute;
  top: var(--cutoff-head-h);
  bottom: 0;
  width: 0;
}

.cutoff-marker--cutoff {
  border-left: 2px solid var(--bad);
}

.cutoff-marker--now {
  border-left: 1px dashed color-mix(in srgb, var(--text) 45%, transparent);
}

.cutoff-marker__label {
  position: absolute;
  bottom: 100%;
  padding-bottom: 0.2rem;
  font-size: 0.68rem;
  font-weight: 650;
  white-space: nowrap;
}

/* The two labels sit back to back on the line, so they diverge as the gap widens
   instead of stacking on top of each other on a tight one. */
.cutoff-marker--cutoff .cutoff-marker__label {
  right: 4px;
  color: var(--bad);
}

.cutoff-marker--now .cutoff-marker__label {
  left: 4px;
  color: var(--text-muted);
}

/* Flipped by the template when a marker sits close enough to an edge that its
   label would hang off the card. */
.cutoff-marker--label-after .cutoff-marker__label {
  right: auto;
  left: 4px;
}

.cutoff-marker--label-before .cutoff-marker__label {
  left: auto;
  right: 4px;
}

.cutoff-lane,
.cutoff-axis {
  display: grid;
  grid-template-columns: var(--cutoff-name-w) 1fr var(--cutoff-value-w);
  column-gap: var(--cutoff-col-gap);
  align-items: center;
}

.cutoff-lane + .cutoff-lane {
  margin-top: 0.35rem;
}

.cutoff-lane__name {
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.cutoff-lane__rail {
  position: relative;
  height: var(--cutoff-rail-h);
  border-radius: 6px;
  background: color-mix(in srgb, var(--text) 5%, transparent);
}

.cutoff-bar {
  position: absolute;
  top: 3px;
  bottom: 3px;
  min-width: 3px;
  border-radius: 4px;
}

.cutoff-bar--collection {
  background: var(--accent);
}

.cutoff-bar--delivery {
  background: color-mix(in srgb, var(--accent) 45%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
}

.cutoff-lane__value {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cutoff-axis {
  height: var(--cutoff-axis-h);
}

.cutoff-axis .cutoff-lane__rail {
  height: var(--cutoff-axis-h);
  background: none;
}

.cutoff-tick {
  position: absolute;
  top: 0.25rem;
  transform: translateX(-50%);
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Day boundary carries up through both lanes — most of these rows straddle one. */
.cutoff-tick--day::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  height: calc(2 * var(--cutoff-rail-h) + 0.35rem + 0.25rem);
  border-left: 1px dashed color-mix(in srgb, var(--text) 22%, transparent);
}

.cutoff-row__evidence {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.cutoff-row__where {
  white-space: nowrap;
}

.cutoff-flag {
  display: inline-block;
  margin-right: 0.4rem;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--bad);
  background: var(--bad-soft);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

@media (max-width: 780px) {
  .cutoff-plot {
    --cutoff-name-w: 4.6rem;
    --cutoff-value-w: 0px;
    --cutoff-col-gap: 0.6rem;
  }

  .cutoff-plot__overlay {
    right: 0;
  }

  .cutoff-lane,
  .cutoff-axis {
    grid-template-columns: var(--cutoff-name-w) 1fr;
  }

  /* Times drop under their own bar rather than disappearing. */
  .cutoff-lane__value {
    grid-column: 2;
    margin-top: 0.2rem;
    font-size: 0.72rem;
  }

  .cutoff-axis .cutoff-lane__value {
    display: none;
  }
}
