
.queue-modal.hidden{display:none}
.queue-modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.58);
  z-index:9999;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
}
.queue-box{
  width:min(1180px,96vw);
  max-height:90vh;
  overflow:auto;
  background:#0f172a;
  color:#e5e7eb;
  border:1px solid #334155;
  border-radius:20px;
  padding:16px;
  box-shadow:0 24px 80px rgba(0,0,0,.48);
}
.queue-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
  border-bottom:1px solid rgba(148,163,184,.25);
  padding-bottom:12px;
}
.queue-head b{font-size:18px}
.queue-head small{display:block;color:#94a3b8;margin-top:3px}
.queue-head-actions{display:flex;gap:8px}
.queue-head button{
  border:1px solid #475569;
  background:#1e293b;
  color:#e5e7eb;
  border-radius:10px;
  padding:8px 12px;
  cursor:pointer;
}
.queue-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
  margin-bottom:12px;
}
.queue-two-cols{
  display:grid;
  grid-template-columns:minmax(320px,.9fr) minmax(420px,1.1fr);
  gap:12px;
}
.queue-panel{
  border:1px solid rgba(148,163,184,.22);
  background:rgba(15,23,42,.65);
  border-radius:16px;
  padding:12px;
}
.queue-panel h3{margin:0 0 10px;font-size:15px}
.qrow{
  display:flex;
  justify-content:space-between;
  gap:12px;
  border-bottom:1px solid rgba(148,163,184,.16);
  padding:7px 0;
}
.q-progress{margin:10px 0}
.q-progress-top{
  display:flex;
  justify-content:space-between;
  font-size:12px;
  margin-bottom:5px;
  color:#cbd5e1;
}
.q-progress-track{
  height:10px;
  background:rgba(51,65,85,.85);
  border-radius:999px;
  overflow:hidden;
  border:1px solid rgba(148,163,184,.18);
}
.q-progress-fill{
  height:100%;
  background:linear-gradient(90deg,#38bdf8,#22c55e);
  border-radius:999px;
  transition:width .25s ease;
}
.q-progress-small{
  margin-top:4px;
  font-size:11px;
  color:#94a3b8;
}
.queue-section-title{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:end;
  margin-bottom:8px;
}
.queue-section-title small{color:#94a3b8}
.queue-study-list{
  display:flex;
  flex-direction:column;
  gap:8px;
  max-height:52vh;
  overflow:auto;
  padding-right:4px;
}
.queue-study-card{
  width:100%;
  text-align:left;
  border:1px solid rgba(148,163,184,.24);
  background:rgba(30,41,59,.62);
  color:#e5e7eb;
  border-radius:14px;
  padding:10px;
  cursor:pointer;
}
.queue-study-card:hover,.queue-study-card.active{
  border-color:rgba(56,189,248,.75);
  background:rgba(14,116,144,.22);
}
.q-study-main{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}
.q-study-sub{
  display:flex;
  flex-direction:column;
  margin-top:5px;
  color:#94a3b8;
}
.q-study-sub small{
  word-break:break-all;
  font-size:10px;
}
.q-mini-reason{
  margin-top:6px;
  font-size:11px;
  color:#cbd5e1;
}
.q-state{
  display:inline-flex;
  border-radius:999px;
  padding:3px 8px;
  font-size:10px;
  font-weight:800;
  border:1px solid rgba(148,163,184,.28);
  background:rgba(148,163,184,.14);
}
.q-state-sent,.q-state-complete,.q-state-completed{
  color:#86efac;
  border-color:rgba(34,197,94,.45);
  background:rgba(34,197,94,.12);
}
.q-state-sending,.q-state-receiving{
  color:#7dd3fc;
  border-color:rgba(56,189,248,.45);
  background:rgba(56,189,248,.12);
}
.q-state-error,.q-state-failed{
  color:#fca5a5;
  border-color:rgba(239,68,68,.45);
  background:rgba(239,68,68,.12);
}
.queue-detail-empty{
  color:#94a3b8;
  border:1px dashed rgba(148,163,184,.35);
  border-radius:14px;
  padding:18px;
}
.queue-detail-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:8px;
}
.q-detail-box{
  border:1px solid rgba(148,163,184,.24);
  background:rgba(30,41,59,.55);
  border-radius:14px;
  padding:12px;
  margin:12px 0;
}
.q-detail-box p{margin:7px 0 0;color:#cbd5e1}
.q-ok-box{
  border-color:rgba(34,197,94,.4);
  background:rgba(34,197,94,.10);
}
.q-error-box{
  border-color:rgba(239,68,68,.45);
  background:rgba(239,68,68,.10);
}
.q-detail-table{
  display:grid;
  grid-template-columns:1fr;
  gap:6px;
}
.q-detail-table b{
  overflow-wrap:anywhere;
  word-break:break-word;
  max-width:100%;
}
.q-detail-table div{
  display:grid;
  grid-template-columns:140px 1fr;
  gap:10px;
  border-bottom:1px solid rgba(148,163,184,.16);
  padding:6px 0;
}
.q-detail-table span{color:#94a3b8}
.q-detail-table b{
  font-weight:600;
  word-break:break-all;
}
@media(max-width:850px){
  .queue-grid,.queue-two-cols{grid-template-columns:1fr}
  .queue-box{max-height:94vh}
}

/* ServerPACS v666: recepción en vivo cuando el backend todavía no conoce el total */
.q-progress-indeterminate .q-progress-track{position:relative;overflow:hidden}
.q-progress-indeterminate .q-progress-fill{
  width:38%!important;
  animation:spQueueReceivingV666 1.15s ease-in-out infinite;
  background:linear-gradient(90deg,#0ea5e9,#38bdf8,#22c55e);
}
.q-progress-receive .q-progress-top b{color:#7dd3fc}
@keyframes spQueueReceivingV666{
  0%{transform:translateX(-115%)}
  55%{transform:translateX(95%)}
  100%{transform:translateX(285%)}
}
@media (prefers-reduced-motion:reduce){
  .q-progress-indeterminate .q-progress-fill{animation:none;width:100%!important;opacity:.55}
}
.q-metrics-panel{margin-top:12px}
.q-series-detail{margin-top:16px;display:grid;gap:8px}
.q-series-detail h3{margin:0 0 4px}
.q-quarantine-card{cursor:default;text-align:left}
.q-quarantine-card .queue-head-actions{margin-top:10px;display:flex;gap:8px;flex-wrap:wrap}
.q-quarantine-card [data-q-delete]{background:#8f2f3c;color:#fff;border-color:#a84450}
.q-assoc-summary{display:grid;grid-template-columns:repeat(4,minmax(120px,1fr));gap:10px;margin-bottom:12px}
.q-assoc-kpi{padding:12px;border-radius:12px;background:#1e293b;border:1px solid #475569;display:flex;justify-content:space-between;align-items:center}
.q-assoc-kpi span{color:#cbd5e1}.q-assoc-kpi b{font-size:22px}
.q-assoc-ok{border-color:#22c55e;background:rgba(34,197,94,.11)}
.q-assoc-fail{border-color:#ef4444;background:rgba(239,68,68,.13)}
.q-assoc-warn{border-color:#f59e0b;background:rgba(245,158,11,.11)}
.q-assoc-list{display:grid;gap:8px;max-height:58vh;overflow:auto}
.q-assoc-event{border-left:5px solid #64748b;background:rgba(15,23,42,.72);border-radius:10px;padding:11px 13px}
.q-assoc-event-ok{border-left-color:#22c55e}.q-assoc-event-fail{border-left-color:#ef4444}.q-assoc-event-wait{border-left-color:#38bdf8}
.q-assoc-event-head{display:flex;gap:12px;justify-content:space-between;align-items:center}
.q-assoc-event-head span{font-size:12px;font-weight:800;padding:4px 7px;border-radius:999px;background:#334155}
.q-assoc-route{color:#7dd3fc;margin-top:5px}.q-assoc-reason{color:#e2e8f0;margin:6px 0}.q-assoc-event small{color:#94a3b8}
@media(max-width:700px){.q-assoc-summary{grid-template-columns:1fr 1fr}.q-assoc-event-head{align-items:flex-start;flex-direction:column}}
