.qc-staff-monitor-backdrop {
  padding: 12px;
}

.modal.qc-staff-monitor {
  width: min(1760px, 100%);
  height: calc(100dvh - 24px);
  max-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  background: #fff;
}

.qc-staff-monitor .modal-head {
  flex: 0 0 auto;
  align-items: flex-start;
}

.qc-staff-monitor .modal-head h2 {
  font-size: 22px;
}

.qc-staff-monitor .modal-head p {
  margin: 5px 0 0;
  color: #526b80;
  font-size: 12px;
}

.qc-staff-monitor-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid #d5e3f1;
  background: #f6f9fc;
  flex: 0 0 auto;
}

.qc-staff-monitor-filters .field {
  min-width: 160px;
  max-width: 300px;
  flex: 1 1 180px;
}

.qc-staff-monitor-filters input,
.qc-staff-monitor-filters select {
  width: 100%;
  min-width: 0;
}

.qc-staff-monitor-body {
  flex: 0 0 auto;
  overflow: visible;
  padding: 0 20px 24px;
}

.qc-staff-monitor-error {
  padding: 10px 12px;
  border-left: 3px solid #c26713;
  color: #773f0c;
  background: #fff6e9;
}

.qc-staff-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid #d5e3f1;
}

.qc-staff-kpis > div {
  min-width: 0;
  padding-left: 12px;
  border-left: 3px solid #007e99;
}

.qc-staff-kpis > div:nth-child(2) { border-color: #2468ce; }
.qc-staff-kpis > div:nth-child(3) { border-color: #b74779; }
.qc-staff-kpis > div:nth-child(4) { border-color: #16805c; }
.qc-staff-kpis span { display: block; color: #526b80; font-size: 12px; }
.qc-staff-kpis strong { display: block; margin-top: 8px; font-size: 26px; line-height: 1.2; overflow-wrap: anywhere; }
.qc-staff-kpis small { font-size: 13px; font-weight: 500; }

.qc-staff-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 28px;
}

.qc-staff-chart-section {
  min-width: 0;
  padding: 20px 0 16px;
  border-bottom: 1px solid #d5e3f1;
}

.qc-staff-monitor h3 {
  font-size: 16px;
  line-height: 1.4;
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}

.qc-staff-chart { position: relative; min-width: 0; }
.qc-staff-chart svg { display: block; width: 100%; height: 232px; }
.qc-staff-chart svg text { font-size: 11px; fill: #405b73; }
.qc-staff-chart-tip {
  position: absolute;
  z-index: 2;
  right: 8px;
  top: 4px;
  max-width: calc(100% - 16px);
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #b7cbdc;
  border-radius: 4px;
  box-shadow: 0 4px 12px #173a5c20;
  font-size: 12px;
  pointer-events: none;
  overflow-wrap: anywhere;
}

.qc-staff-chart-tip strong { display: block; margin-bottom: 4px; }
.qc-staff-chart-tip small { color: #526b80; }
.qc-staff-chart-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; min-height: 28px; }
.qc-staff-chart-legend button {
  border: 0;
  padding: 4px 0;
  background: transparent;
  color: #254459;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.qc-staff-chart-legend i { flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; }
.qc-staff-chart-legend .off { opacity: .45; text-decoration: line-through; }
.qc-staff-summary, .qc-staff-detail-section, .qc-staff-machine-section { padding: 20px 0; border-bottom: 1px solid #d5e3f1; }
.qc-staff-monitor .table-wrap { max-height: 380px; }
.qc-staff-monitor .simple-table { font-size: 12px; }
.qc-staff-monitor .simple-table th { position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.qc-staff-monitor .simple-table td { min-width: 70px; overflow-wrap: anywhere; }
.qc-staff-person-link { border: 0; padding: 0; color: #075cb5; background: transparent; font: inherit; text-align: left; cursor: pointer; }
.qc-staff-person-link:hover { text-decoration: underline; }
.qc-staff-detail-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.qc-staff-detail-head .field { width: 180px; }
.qc-staff-pager { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; font-size: 12px; }
.qc-staff-rules { margin-top: 16px; font-size: 12px; color: #526b80; }
.qc-staff-rules summary { cursor: pointer; font-weight: 700; }
.qc-staff-rules dl { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px 16px; line-height: 1.6; }
.qc-staff-rules dt { font-weight: 700; }
.qc-staff-rules dd { margin: 0; }
.qc-staff-machine-filters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.qc-staff-machine-filters .field { flex: 1 1 180px; max-width: 280px; min-width: 0; }
.qc-staff-machine-filters select { width: 100%; min-width: 0; }
.qc-staff-machine-totals { display: flex; flex-wrap: wrap; gap: 8px 16px; padding-bottom: 12px; font-size: 12px; }
.qc-staff-result { display: inline-block; border-radius: 3px; padding: 3px 6px; line-height: 1.5; font-weight: 600; }
.qc-staff-result.pass { background: #e2f6ec; color: #146146; }
.qc-staff-result.fail { background: #ffe6ea; color: #ab1832; }
.qc-staff-result.insufficient { background: #f0f2f5; color: #4e5863; }
.qc-staff-machine-reason { display: block; margin-top: 4px; color: #526b80; }
.qc-staff-monitor .qc-staff-machine-table th { white-space: normal; min-width: 65px; }
.qc-staff-machine-table summary { cursor: pointer; color: #075cb5; min-width: 130px; }
.qc-staff-machine-times { padding-left: 18px; margin: 8px 0; min-width: 175px; max-height: 220px; overflow: auto; font-variant-numeric: tabular-nums; }
.qc-staff-machine-times li { padding: 4px 0; }
.qc-staff-overdue { color: #b21936; font-weight: 700; }

@media (max-width: 800px) {
  .qc-staff-monitor-backdrop { padding: 4px; }
  .modal.qc-staff-monitor { height: calc(100dvh - 8px); max-height: calc(100dvh - 8px); }
  .qc-staff-monitor-body { padding: 0 12px 18px; }
  .qc-staff-monitor-filters { padding: 10px 12px; gap: 8px; }
  .qc-staff-monitor-filters .field { flex: 1 1 130px; min-width: 130px; max-width: none; }
  .qc-staff-monitor-filters input, .qc-staff-monitor-filters select { font-size: 16px; }
  .qc-staff-chart-grid { grid-template-columns: minmax(0, 1fr); }
  .qc-staff-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 8px; }
  .qc-staff-kpis strong { font-size: 22px; }
  .qc-staff-rules dl { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .qc-staff-rules dd { margin-bottom: 8px; }
  .qc-staff-machine-filters .field { max-width: none; }
  .qc-staff-machine-filters select { font-size: 16px; }
}
