/* =============================================================================
   jobs_tray.css — Track C (C2) background exam-generation jobs tray
   -----------------------------------------------------------------------------
   The compact, dismissible bottom-right panel (jobs_tray.js builds the DOM) that
   lists each in-flight background exam by subject + current stage while the user
   works elsewhere — plus the collapsed reopen pill and the soft, dismissible
   per-job ExamGenLoader modal. Theme-aware via tokens; sits on the backdrop tier
   (below modals + toasts so the done-notification still shows on top).
   ========================================================================== */

.jt-tray {
  position: fixed;
  right: var(--sp-4);
  bottom: var(--sp-4);
  z-index: var(--z-backdrop, 1200);
  width: min(320px, calc(100vw - var(--sp-5)));
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  box-shadow: 0 12px 32px oklch(20% 0.02 239 / 0.20);
  color: var(--ink);
  overflow: hidden;
  animation: jt-rise var(--dur-normal) var(--ease-out);
}
.jt-tray[hidden] { display: none; }

.jt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.jt-title {
  font-family: var(--font-data, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.jt-dismiss {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-subtle);
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: var(--r1);
  cursor: pointer;
}
.jt-dismiss:hover { color: var(--ink); background: color-mix(in oklch, var(--ink) 8%, transparent); }
.jt-dismiss:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.jt-list { list-style: none; margin: 0; padding: var(--sp-2); display: flex; flex-direction: column; gap: var(--sp-2); }

.jt-row { border-radius: var(--r1); overflow: hidden; }
.jt-row-open {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r1);
  background: var(--surface);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.jt-row-open:hover { border-color: var(--border-strong); background: var(--surface-raised); }
.jt-row-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.jt-row-label { font-size: 13px; font-weight: 600; color: var(--ink); }
.jt-row-cap {
  font-family: var(--font-data, ui-monospace, monospace);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-subtle);
}
/* a running row gets a small terracotta tick; failed re-inks the caption */
.jt-row.is-running .jt-row-cap { color: #c0664a; }
.jt-row.is-done .jt-row-cap { color: var(--accent); }
.jt-row.is-failed .jt-row-cap { color: var(--accent); text-transform: none; letter-spacing: 0.02em; }

/* ------------------------------------------------------- collapsed pill -- */
.jt-pill {
  position: fixed;
  right: var(--sp-4);
  bottom: var(--sp-4);
  z-index: var(--z-backdrop, 1200);
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: var(--sp-2) var(--sp-4);
  background: var(--surface-raised);
  color: var(--ink);
  font-family: var(--font-data, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: 0 8px 22px oklch(20% 0.02 239 / 0.18);
  cursor: pointer;
}
.jt-pill[hidden] { display: none; }
.jt-pill:hover { border-color: var(--border-strong); }
.jt-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ----------------------------------------------- per-job card modal ----- */
.jt-card-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal, 1300);
  background: var(--overlay, oklch(25% 0.02 239 / 0.4));
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  padding: var(--sp-5);
  animation: jt-fade var(--dur-fast) var(--ease-out);
}
.jt-card-stage { display: flex; }
.jt-card-close {
  appearance: none;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: var(--sp-2) var(--sp-5);
  background: var(--surface-raised);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}
.jt-card-close:hover { background: var(--surface); }
.jt-card-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@keyframes jt-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes jt-fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .jt-tray, .jt-card-backdrop { animation: none; }
}
