/* The tray of background jobs (ui/tasks-tray.js): one small line at the bottom right of every page, the list opening upward from it. While it is there the page scrolls
   above a band of its own, so that nothing that can be pressed is ever under the tray, wherever the page is scrolled to (ui/tray-room.js moves the scroll across). A wide window
   with an action panel docked at the right puts the tray beside the panel. */

.tasks { position: fixed; right: 14px; bottom: 14px; z-index: 30; display: flex; flex-direction: column; width: min(360px, calc(100vw - 28px)); }
.tasks[hidden] { display: none; }
.tasks-head {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid var(--ln2); border-radius: 8px;
  background: var(--pn); box-shadow: var(--shd); color: var(--tx); font-weight: 600; cursor: pointer; text-align: left;
}
.tasks-head:hover { border-color: var(--dim); }
.tasks-mark { display: inline-flex; align-items: center; flex: none; }
.tasks-words { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tasks-chevron { display: inline-flex; color: var(--dim); }
.tasks-head[aria-expanded="true"] .tasks-chevron svg { transform: rotate(180deg); }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--ln2); border-top-color: var(--accm); border-radius: 50%; animation: tasks-spin 0.9s linear infinite; }
@keyframes tasks-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; border-top-color: var(--accm); border-right-color: var(--accm); } }

.tasks-list {
  display: flex; flex-direction: column; margin: 0 0 6px; padding: 0; list-style: none; max-height: min(60vh, 440px); overflow-y: auto;
  border: 1px solid var(--ln2); border-radius: 8px; background: var(--pn); box-shadow: var(--shd);
}
.tasks-list[hidden] { display: none; }
.task { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--ln); }
.task:last-child { border-bottom: 0; }
.task .node-mark { margin-top: 1px; }
.task-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.task-title { font-weight: 600; overflow-wrap: anywhere; }
.task-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 12px; }
.task-step { overflow-wrap: anywhere; }
.task-clock { font-variant-numeric: tabular-nums; }
.task-detail { margin: 0; font-size: 12px; overflow-wrap: anywhere; }
.task-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.task-actions:empty { display: none; }

/* A page that has the tray scrolls in the view, which ends above the tray's band: the window's height, less --tray-room, is the page's, and the band under it is the tray's. */
body.has-tasks .main { height: 100vh; }
body.has-tasks .view { min-height: 0; overflow-y: auto; }
body.has-tasks .view > * { flex-shrink: 0; }
body.has-tasks .main::after { content: ''; flex: none; box-sizing: border-box; height: var(--tray-room); border-top: 1px solid var(--ln); }
@media (min-width: 1081px) {
  body:has(.panel) .tasks { right: calc(var(--panel-drawn) + 14px); }
  /* The view's own scrollbar (--page-scrollbar, tray-room.js) is beside the docked panel, as the window's is without the band. */
  body.has-tasks .panel { right: var(--page-scrollbar, 0px); }
  body.has-tasks .resizer.is-panel { right: calc(var(--panel-drawn) - 5px + var(--page-scrollbar, 0px)); }
  body.has-tasks:has(.panel) .tasks { right: calc(var(--panel-drawn) + 14px + var(--page-scrollbar, 0px)); }
}
@media (max-width: 599px) {
  .tasks { left: 12px; right: 12px; bottom: 12px; width: auto; }
  body:has(.panel) .tasks { right: 12px; }
}
