/* ==========================================================================
   dispatch.css — Scheduled-jobs (dispatch) panel. Mirrors process.css styling.
   Part of منصة عقاب dashboard styles. Cascade order is significant.
   ========================================================================== */
#dispatch-panel{
  position:fixed; inset:0; z-index:1200; display:none;
  background:rgba(0,0,0,.55); backdrop-filter:blur(3px);
  align-items:center; justify-content:center;
}
#dispatch-panel.open{ display:flex; }
.disp-card{
  width:min(680px,94vw); max-height:86vh; overflow:hidden;
  display:flex; flex-direction:column;
  background:var(--s1); border:1px solid var(--bd); border-radius:14px;
  box-shadow:0 18px 60px rgba(0,0,0,.5);
}
.disp-hdr{
  display:flex; align-items:center; gap:10px;
  padding:14px 16px; border-bottom:1px solid var(--bd);
}
.disp-title{ font-family:var(--fh); font-weight:900; color:var(--t1); font-size:15px; flex:1; }
.disp-selftest, .disp-close{
  background:var(--s2); border:1px solid var(--bd); color:var(--t2);
  border-radius:8px; padding:6px 10px; cursor:pointer; font-family:var(--fb); font-size:12px;
}
.disp-selftest:hover, .disp-close:hover{ color:var(--t1); border-color:var(--g); }
.disp-mode{ padding:8px 16px; }
.disp-body{ overflow-y:auto; padding:6px 16px 16px; }
.disp-section-label{ font-size:11px; color:var(--t3); margin:12px 2px 6px; font-weight:700; }

.disp-row, .disp-run-row{ display:flex; align-items:center; gap:10px; }
.disp-row{
  padding:10px 12px; border:1px solid var(--bd); border-radius:10px;
  margin-bottom:8px; background:var(--s2);
}
.disp-info{ flex:1; min-width:0; }
.disp-name{ font-weight:700; color:var(--t1); font-size:13px; }
.disp-persona{ color:var(--g); font-size:11px; margin-inline-start:6px; }
.disp-meta{ color:var(--t3); font-size:11px; margin-top:2px; }
.disp-next{ color:var(--t2); }
.disp-last{ margin-top:4px; }
.disp-actions{ display:flex; flex-direction:column; gap:6px; flex-shrink:0; }
.disp-btn{
  border:1px solid var(--bd); background:var(--s1); color:var(--t2);
  border-radius:8px; padding:5px 10px; cursor:pointer; font-family:var(--fb); font-size:11px; white-space:nowrap;
}
.disp-btn.run:hover{ color:var(--green); border-color:var(--green); }
.disp-btn.pause:hover{ color:var(--amber); border-color:var(--amber); }
.disp-btn.resume:hover{ color:var(--green); border-color:var(--green); }

.disp-pill{ display:inline-block; padding:1px 8px; border-radius:9999px; font-size:10px; font-weight:700; }
.disp-pill.ok{ background:rgba(82,217,126,.15); color:var(--green); }
.disp-pill.bad{ background:rgba(232,96,96,.15); color:var(--red); }
.disp-pill.run{ background:rgba(232,168,58,.15); color:var(--amber); }
.disp-pill.idle{ background:var(--s2); color:var(--t3); }
.disp-pill.warn{ background:rgba(232,168,58,.15); color:var(--amber); }

/* Preflight readiness checklist */
.disp-pf-head{ font-size:12px; font-weight:700; margin:2px 0 6px; }
.disp-pf-head.ok{ color:var(--green); }
.disp-pf-head.bad{ color:var(--amber); }
.disp-pf-row{ display:flex; align-items:center; gap:8px; padding:3px 2px; font-size:11px; }
.disp-pf-detail{ color:var(--t3); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.disp-ago{ color:var(--t3); font-size:11px; margin-inline-start:6px; }

.disp-run-row{ padding:6px 4px; border-bottom:1px solid var(--bd); font-size:12px; }
.disp-run-job{ color:var(--t1); font-weight:600; }
.disp-run-trig{ color:var(--t3); font-size:11px; }
.disp-empty{ color:var(--t3); text-align:center; padding:18px; font-size:12px; }

/* Live self-test timeline */
.disp-selftest-block{
  margin:10px 0 4px;
  border:1px solid var(--bd);
  background:var(--s2);
  border-radius:10px;
  padding:8px 10px 4px;
}
.disp-st-head{
  display:flex; align-items:center; gap:8px; flex-wrap:wrap;
  padding:2px 0 6px;
  border-bottom:1px dashed var(--bd);
  margin-bottom:6px;
}
.disp-st-rid{ color:var(--t3); font-size:11px; }
.disp-st-rid code{ color:var(--t2); background:var(--s1); padding:1px 6px; border-radius:6px; }
.disp-st-elapsed-total{ color:var(--t3); font-size:11px; margin-inline-start:auto; }
.disp-st-list{ display:flex; flex-direction:column; gap:3px; }
.disp-st-row{
  display:grid;
  grid-template-columns: 60px 1fr auto 56px;
  align-items:center; gap:8px;
  padding:4px 2px;
  font-size:11.5px;
  border-bottom:1px solid rgba(255,255,255,.04);
}
.disp-st-row:last-child{ border-bottom:none; }
.disp-st-step{ color:var(--t1); font-weight:600; }
.disp-st-detail{
  color:var(--t3); font-size:11px;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  direction:ltr; text-align:start;
}
.disp-st-elapsed{ color:var(--t3); font-size:10.5px; text-align:end; font-variant-numeric:tabular-nums; }
.disp-st-error{ color:var(--red); font-size:12px; padding:6px 4px; }
/* Subtle pulse on the currently-running row */
.disp-st-row .disp-pill.run{ animation: dispPulse 1.2s ease-in-out infinite; }
@keyframes dispPulse{ 0%,100%{ opacity:1 } 50%{ opacity:.55 } }

/* View-live button + running-row accent */
.disp-btn.view:hover{ color:var(--g); border-color:var(--g); }
.disp-btn.view.live{ color:var(--amber); border-color:var(--amber); animation: dispPulse 1.4s ease-in-out infinite; }
.disp-row.running{ border-color:var(--amber); box-shadow:0 0 0 1px rgba(232,168,58,.12) inset; }

/* ── Live run transcript (reasoning + chat-style collapsible tool calls) ────── */
.disp-live-block{
  margin:14px 0 6px; border:1px solid var(--g); border-radius:14px;
  background:var(--s2); overflow:hidden;
  display:flex; flex-direction:column; max-height:64vh;
  box-shadow:0 6px 22px rgba(0,0,0,.10);
}
.lr-head{
  display:flex; align-items:center; gap:8px; flex-wrap:wrap;
  padding:10px 12px; border-bottom:1px solid var(--bd);
  background:linear-gradient(to bottom, var(--s1), var(--s2));
}
.lr-title{ font-weight:800; color:var(--t1); font-size:13px; flex:1 1 120px; min-width:0;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.lr-elapsed{ color:var(--t3); font-size:11px; font-variant-numeric:tabular-nums; flex-shrink:0; }
.lr-actions{ display:flex; align-items:center; gap:6px; flex-shrink:0; margin-inline-start:auto; }
.lr-head .disp-pill.run{ animation: dispPulse 1.2s ease-in-out infinite; }
.lr-close{ font-size:11px; }
.lr-stop{ color:var(--red); border-color:rgba(232,96,96,.5); }
.lr-stop:hover{ background:rgba(232,96,96,.12); }
.lr-restart{ color:var(--g); border-color:var(--g); }
.lr-restart:hover{ background:var(--gd); }
.lr-body{ overflow-y:auto; padding:12px; display:flex; flex-direction:column; gap:9px;
  -webkit-overflow-scrolling:touch; }
/* The chat's tool-call dropdowns (.tc-item, from turns.css) are reused verbatim
   here — make them fill the narrower dispatch panel cleanly. */
.lr-body .tc-item{ width:100%; max-width:100%; }

/* Assistant text blocks */
.lr-block{ font-size:13px; line-height:1.75; color:var(--t2); white-space:pre-wrap;
  word-break:break-word; }
.lr-block.lr-reason{ color:var(--t3); border-inline-start:2px solid var(--bd); padding-inline-start:9px; }
.lr-block.lr-reply{ color:var(--t1); background:var(--s1); border:1px solid var(--bd);
  border-radius:10px; padding:9px 11px; }
.lr-block.lr-info{ color:var(--t2); background:var(--s1); border:1px dashed var(--bd);
  border-radius:8px; padding:7px 10px; font-size:12.5px; }
.lr-block.lr-error{ color:var(--red); background:rgba(232,96,96,.08);
  border:1px solid rgba(232,96,96,.35); border-radius:8px; padding:7px 10px; }
.lr-artifact{ font-size:12.5px; }
.lr-artifact a{ color:var(--g); text-decoration:none; font-weight:700; }
.lr-artifact a:hover{ text-decoration:underline; }
.lr-art-cap{ color:var(--t3); font-size:11px; }

/* Topbar button reuses #proc-badge styling; this is the scheduling variant */
#disp-badge{
  display:flex; align-items:center; gap:5px; cursor:pointer;
  background:var(--s2); border:1px solid var(--bd); color:var(--t2);
  border-radius:9999px; padding:5px 11px; font-size:12px; font-family:var(--fb);
}
#disp-badge:hover{ color:var(--t1); border-color:var(--g); }
