.timeline-card {
  padding: 0;
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.timeline-card__head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1.1rem 1.35rem;
  color: var(--accent);
}

.timeline-card__head .card-heading {
  margin: 0;
  color: var(--text);
}

.timeline-card__count {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
}

.timeline-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 1.35rem 0.75rem;
}

.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.timeline-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.timeline-legend__dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}

.timeline-legend__dot--reschedule {
  background: var(--warn);
}

.timeline-legend__dot--courier {
  background: var(--good);
}

.timeline-legend__system {
  opacity: 0.65;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.68rem;
}

.timeline__source {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.2rem;
  color: var(--accent);
}

.timeline__source--reschedule {
  color: var(--warn);
}

.timeline__source--courier {
  color: var(--good);
}

.timeline-view-toggle {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.2rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--text) 6%, transparent);
}

.timeline-view-toggle__btn {
  padding: 0.35rem 0.85rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.timeline-view-toggle__btn:hover {
  color: var(--text);
}

.timeline-view-toggle__btn--active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--text) 10%, transparent);
}

.timeline-card .timeline {
  padding: 0 1.35rem 1.35rem;
}

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

.timeline--scroll {
  max-height: 26rem;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.timeline__item {
  position: relative;
  display: flex;
  gap: 0.9rem;
  padding-bottom: 1.25rem;
  padding-left: 0.1rem;
}

.timeline__item::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 16px;
  bottom: -4px;
  width: 1px;
  background: var(--border);
}

.timeline__item:last-child::before {
  display: none;
}

.timeline__marker {
  flex-shrink: 0;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  margin-top: 4px;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.timeline__item--undeliverable .timeline__marker,
.timeline__item--unsuccessful .timeline__marker {
  background: var(--bad);
  box-shadow: 0 0 0 3px var(--bad-soft);
}

.timeline__item--rescheduled .timeline__marker {
  background: var(--warn);
  box-shadow: 0 0 0 3px var(--warn-soft);
}

.timeline__item--collection_rescheduled .timeline__marker {
  background: var(--bad);
  box-shadow: 0 0 0 3px var(--bad-soft);
}

.timeline__item--courier_dispatch .timeline__marker {
  background: var(--good);
  box-shadow: 0 0 0 3px var(--good-soft);
}

.timeline__item--noise .timeline__marker {
  background: var(--text-muted);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text-muted) 16%, transparent);
}

.timeline__item--noise {
  opacity: 0.55;
}

.timeline__time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.timeline__title {
  font-size: 0.9rem;
  font-weight: 600;
}

.timeline__title a {
  color: var(--accent);
}

.timeline__tag {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text-muted);
}

.stop-request-link {
  display: inline-flex;
  align-items: center;
  margin-left: 0.4rem;
  padding: 0.05rem 0.5rem;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.stop-request-link:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.timeline__meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.timeline__note {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--bad);
  margin-top: 0.3rem;
}

.timeline__empty {
  color: var(--text-muted);
  font-size: 0.875rem;
  list-style: none;
}

/* Horizontal timeline (journey timeline) */

.timeline--horizontal {
  display: flex;
  align-items: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.5rem;
}

.timeline--horizontal .timeline__item {
  flex: 0 0 auto;
  width: 200px;
  flex-direction: column;
  padding-bottom: 0;
  padding-right: 1.75rem;
  padding-left: 0;
}

.timeline--horizontal .timeline__item::before {
  left: 11px;
  right: 0;
  top: 5px;
  bottom: auto;
  width: auto;
  height: 1px;
}

.timeline--horizontal .timeline__marker {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.timeline--horizontal .timeline__body {
  min-width: 0;
}

.leg-group {
  margin-bottom: 1.1rem;
}

.leg-group:last-child {
  margin-bottom: 0;
}

.leg-group__label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.leg-group__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.leg-group__list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

.leg-group__list li:last-child {
  border-bottom: none;
}

.leg-group__item--deleted {
  opacity: 0.5;
  text-decoration: line-through;
}

.leg-group__toggle {
  justify-content: flex-start !important;
  border-bottom: none !important;
  padding-top: 0.6rem !important;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

.stop {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.stop:last-child {
  border-bottom: none;
}

.stop__header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.stop__kind {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.stop__admin-link {
  margin-left: auto;
}

.stop-request-link--unresolved {
  border-color: var(--border);
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text-muted);
}

.provider-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text-muted);
}

.provider-pill--good {
  background: var(--good-soft);
  color: var(--good);
}

.provider-pill--bad {
  background: var(--bad-soft);
  color: var(--bad);
}

/* Same as the base pill, but stated explicitly so the neutral case doesn't
   silently change if .provider-pill's defaults are ever restyled. */
.provider-pill--neutral {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text-muted);
}

.stop__address {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.stop__contact,
.stop__window {
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.stop__status {
  font-weight: 600;
  margin-top: 0.35rem;
}

.stop__status--good { color: var(--good); }
.stop__status--bad { color: var(--bad); }

.stop__items {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
}

.stop__note {
  margin-top: 0.4rem;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  background: var(--bad-soft);
  color: var(--bad);
  font-size: 0.8rem;
}

.stop__note strong {
  font-weight: 700;
}

.stop__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.7rem;
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.stop__footer a {
  color: var(--accent);
}

.kv-list {
  margin: 0;
}

.kv-list__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.kv-list__row:last-child {
  border-bottom: none;
}

.kv-list__row dt {
  color: var(--text-muted);
  flex-shrink: 0;
}

.kv-list__row dd {
  margin: 0;
  text-align: right;
}

.kv-list__mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  word-break: break-all;
}

.kv-list__mono a {
  color: var(--accent);
}

.admin-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.5rem;
  padding: 0.15rem 0.55rem;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.admin-link-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.admin-link-btn svg {
  flex-shrink: 0;
}
